View Full Version : Memory-fix by Harkonnen is out!


Pages : [1] 2 3 4 5

Harkonnen
Dec 07, 2005, 01:27 AM
Current version of the fix is not compatible with 1.52. It either does nothing or crashes. Update addressing this issue is on its way.

The patch I was coding during last month is finally out.

The patch is compatible with 1.00 and 1.09 versions of civ4.

So, 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):
http://209.174.48.134/downloads/harkfix.zip

Or you may want to download those files separately:
http://www.sampo.ru/~headden/zlib1.dll
http://www.sampo.ru/~headden/Patch.v01/PatchByHarkonnen.dll
http://www.sampo.ru/~headden/Patch.v01/Harkonnen.ini

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

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

!IMPORTANT!

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):
http://forums.civfanatics.com/showpost.php?p=3422050&postcount=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.

!END-OF-IMPORTANT!

Subscribe this thread (http://forums.civfanatics.com/showthread.php?p=3434431) 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:
http://sampo.ru/~headden/Harkonnen%20AD-1961.Civ4SavedGame

-----

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? (http://forums.civfanatics.com/showthread.php?t=137706) 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:
http://www.sampo.ru/~headden/zlib.Original
http://www.sampo.ru/~headden/Python.Original

If after installing / rolling back the game says it can't find 'hapdbg.dll', you may either reinstall the game or download it from:
http://www.sampo.ru/~headden/hapdbg.dll

Harkonnen
Dec 07, 2005, 01:31 AM
P.P.S: In my last tests I reinstalled the game and didn't perform FPK unpacking step.

P.P.P.S: As Kangaroo said in 'memory leak' thread, "SyncInput = 1" might solve CTD problems. I could live with both 0 and 1. As I've noted, this helped primarily nVidia users.

@rjen
Dec 07, 2005, 02:21 AM
A big thank you, Harkonnen! :goodjob:
Your patch has a significant positive effect on the performance. My saved late games (1950+) on a standard map are running very smooth now! Even your 1961AD save on a HUGE map has become (at least) playable for me :D

Although I prefer to run the game in Full Screen mode, and with medium graphics and animations turned on; it proves to be of almost no effect on the new performance.

You're the man! :king:

My specs: Celeron D 335 2,8 Ghz, 1 GB Ram, Radeon 9550 128 MB.

Harkonnen
Dec 07, 2005, 02:34 AM
@rjen
Thanks man! The first reply is good, I'm 50% less nervous since now :)

Did you use insane mode?

Full-screen is ok, just with 'insane_mode = 1' you might get corrupted graphics after alt-tabbing back to game. Also, all that "dancing" around low quaity graphics are more for 512Mb systems (like mine) :)

@rjen
Dec 07, 2005, 03:00 AM
You're very welcome :lol:

You're right about the insane_mode, when it's turned to 1 and I alt-tab and back to the game with Full Screen, the map becomes black. With insane_mode = 0 this problem is fixed! I didn't notice a decrease in speed yet with this particular setting.

When the US wakes up in a couple of hours I surely expect and hope there will be plenty of praising replies!

Good luck with optimizing your patch, if needed! But first enjoy your free time after what probably has been nights of work :crazyeye: :king:

Harkonnen
Dec 07, 2005, 03:36 AM
@rjen
Thanks :) Yeah, I'm currently at work (it's day over here) - I think this gonna grow large when I come home... I've posted a link in all threads related to this problem.

insane_mode is driven towards reducing memory usage at price of alt-tabbing stability (and it might even not work on nVidia) and at price of some speed, but speed penalty of insane mode appears to be negligible.

Its primary goal is to get below that thin threshold when the game swaps like a hell and when it's a paradise (512Mb systems). With 1Gb it isn't an issue as it doesn't matter if the game consumes 600Mb or 800mb, as long as it is within that 1Gb.

Wolfwood
Dec 07, 2005, 04:02 AM
Wow! For the first time in weeks I had to actually EXIT the game to stop playing! No crashes at all and my system only has 64Mb graphics memory (set the usage to 50Mb and using medium settings). 1GB of system memory may help as well.

Oh, now I cannot wait until the evening to game some more!

A big thank you to you, Harkonnen!

Harkonnen
Dec 07, 2005, 04:28 AM
Wolfwood
Glad for you :) BTW, Karelia (my part of Russia) is very close to Finland.

I am very interested if 'insane_mode = 1' works. Especially for those who has low-end(9200)/high-end(x800) ATi chips and any nVidia video chips.

(I will reply less frequently since now to keep this thread compact. I see it's gonna be big...)

Nicos_Rex
Dec 07, 2005, 04:32 AM
Thank you Harkonnen!

I have spent far too much time trying to get this game to run acceptably on my system. Following your instructions, I have just loaded my "guaranteed CTD" save and been able to continue for several turns at a rollicking speed.

Insane mode = 1 works fine on my GeForce Ti4200 (128Mb) card.

Your efforts and expertise are greatly appreciated.

panzooka
Dec 07, 2005, 05:45 AM
tell us what u did with dll files, what is the theory behind this

edit: sorry i didnt follow your other thread, so..

The Great Apple
Dec 07, 2005, 05:53 AM
Works wonderfully! Thanks very much.

I do get the black terrrain problem when I alt-tab the game, but I think that may be because I'm being stubborn and not using windowed mode...

I have isane mode on with a GeForce 5700LE - never had any CTDs before (except when I accidently pressed alt-F4 - very easy to do!), and I haven't had any since.

Dragon67
Dec 07, 2005, 05:58 AM
Good work Harkonnen. :)
And since the cdt affect a lot of users, it may bee an idea too make the thread sticky?

Harkonnen
Dec 07, 2005, 06:02 AM
panzooka
Basically I am reusing entities for which new copies are created by civ4. I am not 100% sure, but it seems that these entities (geometry primitives) become tangliable only at low level of Direct3D, thus only there they can be managed - that's what my .dll does. GameBryo engine works at meshes/models level, so I think civ4 can't detect duplicates there. E.g. even if ten houses are different, there are still a lot of duplicate items in them - bricks for example, but you must go down to bricks level to mess with them.

The Great Apple
Setting 'insane_mode = 0' will remove alt-tabbing issues if alt-tabbing is important for you in full screen mode. Though it will increase memory usage and if you are low on RAM, it might start swapping again.

Harkonnen
Dec 07, 2005, 06:08 AM
Dragon67
Well, in case memory usage was the reason of CTDs... Anyway, a lot of people suffered from swapping too (me for example), and so far I see it's solved.

What should I do to make this thread sticky? Notify moderators?

phalzyr
Dec 07, 2005, 06:21 AM
Yep notify mods and if you need a mirror http://209.174.48.134/downloads/harkfix.zip I put the first thread info in the hark_readme file within the zip... My Outlook was acting a bit weird like it does before T1 goes down(physically) but hopefully just something at email server side...(we don't handle our own email)

P.S. All files zipped are less than the main one unzipped, that has to be dloaded...872KB compared to 1.8MB...

EDIT: Now with zlib only 48K :D

Dragon67
Dec 07, 2005, 06:26 AM
Yes, you should notify them about it. Maybe as a sticky or in the same way they handled the ati solution earlier on. I believe it will affect a lot people, including me, so why not. Maybe after a few days’ ore so, just too make us 100% sure that none other issues turns up.

Harkonnen
Dec 07, 2005, 06:30 AM
I will write small loader later today, so we end up with something like 30Kb. This was a test release, I didn't expect so much downloads, and I didn't expect all of them to work so fine... Lemme just get to my hope PC...

phalzyr
Dec 07, 2005, 06:39 AM
:) hopefully my email issues are just the fact they been moving to new server, not foresight of trouble... Let me know when you got the new version out, though like I said on other posts I don't have internet at home... I also leave work early but if you time frame is off from ours that might not matter depending on how much "later today" is ;) At worst I'l get the other version with installer up the next morning (my morning) :D

Strawberry
Dec 07, 2005, 07:23 AM
Sorry, silly question but I am not very techie. Can this be used with 1.09?

Harkonnen
Dec 07, 2005, 07:27 AM
Yes. I started it with version 1.00, and finished when 1.09 came out. It's independent patch, it will work with 1.10 and forth as well.

The Great Apple
Dec 07, 2005, 07:56 AM
Yes. I started it with version 1.00, and finished when 1.09 came out. It's independent patch, it will work with 1.10 and forth as well.
Hmmm - except that the patcher might check for .dll consistancy when it patches.

warpstorm
Dec 07, 2005, 07:56 AM
Are you going to release source code? Without the ability to see what you changed (and recompile it myself) I will not download and execute dlls.

robaughjr
Dec 07, 2005, 08:22 AM
This solved my movie stuttering! You rock man!

phalzyr
Dec 07, 2005, 08:37 AM
Can't wait to try it MP, SP I have no issues but last night my secodary began to have moments of slow response...

Hark: BTW it looks like there is going to be a meeting that I have to go to at my usual leave time so I'll be here a bit later than norm to put the file up on my mirror though you could always do fileplanet or such with the final release. I'll give it a go in pirates and see if it effects anything, is there anything special I have to do? like rename files or such... prob not...

CyberChrist
Dec 07, 2005, 08:42 AM
Well done! :goodjob:

Reduction of slow down is significant. However it seems that the leaderheads get corrupted after a while (with insane_mode=1 in full screen), but that may be because I loaded a few saves without restarting CIV.

sabrewolf
Dec 07, 2005, 09:19 AM
Are you going to release source code? Without the ability to see what you changed (and recompile it myself) I will not download and execute dlls.

paranoid... like me ;)

but honestly: you should submit your stuff to firaxis. i'm sure they would appreciate you fixing one of the memory leaks and would surely add you in the credits. this would also reduce the concerns of us paranoid people :goodjob:

Harkonnen
Dec 07, 2005, 09:22 AM
warpstorm
I understand your worries, but I've spent around a month with this patch, all my free time and even more. I mean I will make an offer to Firaxis as soon as I see that this patch is really helpful. Currently I see it is.

If Firaxis refuses to deal with me, I will publicly release it, probably even with an article on codeproject or something like that. I have released binaries, and I will release the source as soon as making it public won't hurt my interests in my deal with Firaxis if it's ever gonna happen. I wouldn't think about any kind of "deal" with Firaxis if it would be very easy, or even very hard, but easy in the last instance - this last version.

It is very complex code with very complex approach and a lot of rewriting and profiling. Heck, it contains dynamic assembly code allocations near template specialization next line... so it's gonna cost.

I am a bit different man, as compared to those who would spread trojans, viruses and alike through this most-wanted patch (also I doubt that kind of people would pursue their goals this way). Yes, I know ASM pretty well, but that's becauses I'm ~12 years with computer in my 22. Also I have attended ACM programming contest world finals twice. I don't want to boast, just people at these contests are sooner "awkward eggheads" rather than so-called "russian mafia" spreading s**t on the web.

P.S: If you look into the very begining of 'memory leak' thread, you will see that I HAVE released source when I tried some easy effort of reporting less physical RAM. After all it's 174Kb of source code in size, and the code isn't yet well-organized. Wanna read it? :)

Harkonnen
Dec 07, 2005, 09:24 AM
sabrewolf
You're reading my mind :)

Well, anyway - you'll see it either as part of next official Firaxis patch or as a source code.

Harkonnen
Dec 07, 2005, 09:26 AM
phalzyr
About "Pirates". If they use "python24.dll" too like civ4 does, then steps are the same. If not, you'll have to wait a couple of hours until I release a loader, so we don't need to carry that python burden anymore.

phalzyr
Dec 07, 2005, 09:31 AM
phalzyr
About "Pirates". If they use "python24.dll" too like civ4 does, then steps are the same. If not, you'll have to wait a couple of hours until I release a loader, so we don't need to carry that python burden anymore.

Couple hours? Cool I'll still be here for about 3 more. Any more than that though... :D

Harkonnen
Dec 07, 2005, 09:49 AM
CyberChrist and all
If 'insane_mode=1' starts well, plays well, but some time later gives visual bugs WITHOUT alt-tabbing, then decreasing 'vid_mem_usage' should help leaving 'insane_mode=1'. Try ~30-40 Mb if you experience visual bugs even without alt-tabbing in insane mode.

The effect of vid_mem_usage should be kind of such:
slow-slow-avg-avg-best-avg-slow-slow-bugs-crash

It's up to you to find that golden "best"... It depends on video memory and AGP apperture size (the latter is set in BIOS to 32, 64, 128 or 256Mb, depending on your motherboard capabilities). But if that would be everything it depends on, I would set it automatically. The nasty thing is that it also depends on graphics quality you select, and that is hard to track from my code.

gunnergoz
Dec 07, 2005, 10:29 AM
Great work, Harkonnen, thank you!

warpstorm
Dec 07, 2005, 10:57 AM
Wanna read it? :)

Sure, if the comments are in English.

NateDawgNY
Dec 07, 2005, 10:59 AM
Outstanding! I will definitely be trying this out when I get home.

BlueLikeYou
Dec 07, 2005, 11:00 AM
I will give this a shot tonight after work and see how it goes. :)

Joebasalt13
Dec 07, 2005, 11:17 AM
Need Help From Harkonnen or anyone who has used his patch! When I try to enter the Configure settings file it says access denied how do I get around this?

phalzyr
Dec 07, 2005, 11:41 AM
What program are you using to try to open the ini file? Is civ 4 running at same time? Oh and where did you download them to, it sounds like a NTFS file security issue could be the cause also...

Edit: One more thing... did you try right clicking the ini and chose "open with" and select notepad?

OH and Hark: The meeting got canceled so I'll be here another hour rather than two, otherwise I'll miror first thing tomorrow.

Briareos
Dec 07, 2005, 11:54 AM
I'm afraid your patch crashes my Civ IV during the "Init Engine" stage. Here's what I get in the event log:

Faulting application civilization4.exe, version 1.0.9.1722, faulting module patchbyharkonnen.dll, version 0.0.0.0, fault address 0x000017f6.

As soon as I set patch_on to 0 it starts working again, so it's probably not the python DLL. Using the patch with insane_mode off doesn't fix it, either.

I'm using a ATI Radeon 9800 Pro with 128 MB and the 5.11 Catalysts, so I guess it's not the graphics hardware... :)

Is there anything I can supply you with, like a Dr. Watson log or the memory dump or something?

(I'd break out the debugger, but debugging without source is a bit beyond what I'd want to do...)

ainwood
Dec 07, 2005, 12:01 PM
Moved to Civ4 Utility Programs

Wolfwood
Dec 07, 2005, 12:08 PM
I'm afraid your patch crashes my Civ IV during the "Init Engine" stage. Here's what I get in the event log:

Did you try holding the shift button down while starting up the game?

Briareos
Dec 07, 2005, 12:12 PM
Did you try holding the shift button down while starting up the game?
Yes, I did - but it didn't change anything.

np: AFX - Children Talking (Hangable Auto Bulb)

Dikaioma
Dec 07, 2005, 12:13 PM
Ok... so it was working. I then restarted the computer to go into bios to see what my aperture size was for the mem fix. When I tried to launch the game again, I got the same error Briareos described. Holding shift does not fix this.

EDIT: Also, manually clearing the cache does nothing.

FranklinNoble
Dec 07, 2005, 12:27 PM
Seems to work ok for me... game looks a little smoother... still choppy opening video... I'll continue to play with it for a while.

Harkonnen
Dec 07, 2005, 12:37 PM
Briareos
Wolfwood
Are you running some compatility mode for civilization4.exe (like win95/98/me/2k in civ4 shortcut)?

If you do, this might be the issue since in this mode native d3d9.dll calls are made from another compability DLL, so my patch is placing itself between D3D and D3D which is not good, I've been through that...

If this is true, please PM or mail me to get workaround. I know how to avoid setting compatibility mode in situations where it is necessary.

Harkonnen
Dec 07, 2005, 12:40 PM
Joebasalt13
You are probably trying to launch civ4 from a different user. Fixing config.ini entries isn't 100% necessary step, you may try skipping this step.

anti_strunt
Dec 07, 2005, 12:42 PM
This rocks! Though I still lag pretty bad when zooming out with a huge world, despite 1GB memory and 256 MB vid card... Oh well, that's to be expected I suppose. Still, this rocks, very much indeed...

Harkonnen
Dec 07, 2005, 12:44 PM
warpstorm
Yes, they are in English. Here's the function which failed for Briareos and Wolfwood (though without comments)
http://sampo.ru/~headden/set_indices.cpp

Harkonnen
Dec 07, 2005, 12:45 PM
anti_strunt
Did you try setting 'vid_mem_usage' to 180 in Harkonnen.ini? This might help a lot... and I am very interested how better (or worse?) it becomes with this change.

anti_strunt
Dec 07, 2005, 12:59 PM
1 GB RAM
256 MB Card

Patch = 1
VidMem = 180
Insane Mode = 1

Low res textures = on
Anti-alias = 0
All graphic settings = low
Disable globe view buildings = on

Windowed mode

The game still lags when going to the globe view on a huge (non-Terra), late-game map. Don't know if this is helpful or anything; still, it's much better than before, so thanks a lot! :)

Briareos
Dec 07, 2005, 01:01 PM
warpstorm
Yes, they are in English. Here's the function which failed for Briareos and Wolfwood (though without comments)
http://sampo.ru/~headden/set_indices.cpp
No, I'm not using any compatibility mode to run Civ IV - just plain Windows XP SP2.

Well, what do you know - since the code you linked to looks like it's doing the actual hooking I got the great idea of turning off ATI Tray Tools' frame rate display, which obviously also hooks into D3D, and it magically started working...

Should've done this all along, of course... *bangs head on table*

np: Cyne - Evolution Fight (Evolution Fight)

Harkonnen
Dec 07, 2005, 01:02 PM
anti_strunt
Thanks for the info! :)

The last thing you may try is switching to globe view, back to map and then again to globe view. With your nice 256Mb vid-ram configuration this might leave enough data in video memory cache to make the second transition fast enough.

Harkonnen
Dec 07, 2005, 01:05 PM
Briareos
Thanks!! What a relief :) I spent last 3 days making it a stable release, and after those crashes... phew, it's ok now.

I think I will switch from NOT-'d3d9.dll' call towards 'civ4.exe/game-dll'-call.

Wolfwood
Dec 07, 2005, 01:14 PM
warpstorm
Yes, they are in English. Here's the function which failed for Briareos and Wolfwood (though without comments)
http://sampo.ru/~headden/set_indices.cpp

I don't know where the mix-up cropped up, but the game is working perfectly for me. It starts and runs perfectly and smoothly enough.

Briareos
Dec 07, 2005, 01:19 PM
Briareos
Thanks!! What a relief :) I spent last 3 days making it a stable release, and after those crashes... phew, it's ok now.

I think I will switch from NOT-'d3d9.dll' call towards 'civ4.exe/game-dll'-call.
Well, this is probably not directly related to your patch - but is globe view usable for anyone when used with the saved game you've got on your server?

I'm getting 1 frame per second when I zoom out fully... :(

Dunno how many frames I get when I zoom in enough to just not trigger globe view, but it's quite usable. Since I can't use ATI Tray Tools to measure the frame rate - would it be possible to add that functionality to the patch?

Just a suggestion... :)

np: Cyne - Rappin' (Evolution Fight)

Gaias
Dec 07, 2005, 01:24 PM
I just have a quick question... Am I suppose to see a 43% reduction in memory usuage? :eek:

Absolutely frickin awesome! :goodjob:

Thank you so very much! :cool:

anti_strunt
Dec 07, 2005, 01:24 PM
anti_strunt
Thanks for the info! :)

The last thing you may try is switching to globe view, back to map and then again to globe view. With your nice 256Mb vid-ram configuration this might leave enough data in video memory cache to make the second transition fast enough.

Hmm, sorry, didn't do anything. It's odd that a computer that can play Half-Life 2 without a hitch should have problems with cIV, but whadayya know? :crazyeye:

Dikaioma
Dec 07, 2005, 01:44 PM
...turning off ATI Tray Tools' frame rate display, which obviously also hooks into D3D, and it magically started working...

What is this? Since I have this, and this patch stopped working for some reason, maybe you could help me?

EDIT: Nevermind. It's working now.

Harkonnen
Dec 07, 2005, 01:51 PM
Wolfwood
Yeah, I meant Dikaioma. Sorry :)

Briareos
Yes, I have about same framerate, but now it can't be blamed for swapping since now there is no swapping anymore. I think this is some stuff with amount of cities (their bars are most probably drawn with user interface subsystem). If this is true, I have nice idea of speeding it up in my next release.

anti_strunt
Well, even my p3-1.3Ghz / 512Mb system allowed me to play FarCry with everything maxed out in 1024x768x32, 6xAA, 16xAF with highest difficulty settings... and to finish the game without cheats. What can I say... This was the reason for me to write that patch, I just couldn't agree that civ4 needs so much :)

Harkonnen
Dec 07, 2005, 01:53 PM
Gaias
You mean you got it? Heck, you weren't... unless you have 256Mb video memory :) BTW, thanks!

Dikaioma
Dec 07, 2005, 04:06 PM
Well, even my p3-1.3Ghz / 512Mb system allowed me to play FarCry with everything maxed out in 1024x768x32, 6xAA, 16xAF with highest difficulty settings...

Tell me about it... I just finished playing F.E.A.R with super high settings, and no crazy slow downs.

Smidlee
Dec 07, 2005, 04:25 PM
So this wouldn't help me since I've got 2gb of ram. I also get very bad framerate when zoomed out to cloud level on fully loaded huge maps.

( It may help when I tried playing a 256x160 map since this game started out 2.1 gb of ram.)

Briareos
Dec 07, 2005, 04:30 PM
Briareos
Yes, I have about same framerate, but now it can't be blamed for swapping since now there is no swapping anymore. I think this is some stuff with amount of cities (their bars are most probably drawn with user interface subsystem). If this is true, I have nice idea of speeding it up in my next release.
I fear there's something more evil going on here...

If I load the DesertWar scenario, I get a drop from 25-30 FPS to 8 FPS as soon as I zoom out enough to trigger globe view, and that's with just a handful of cities being visible.

As soon as I hit CTRL-F to switch to Camera Flying mode, the framerate goes back to normal (i.e. more than 20 FPS as long as I don't zoom out further), even though the same city data is still being displayed - shouldn't the framerate drop when the landscape is rendered instead of being a texture? :crazyeye:

np: Eric B. & Rakim - As The Rhyme Goes On (Radio Mix) (Paid In Full)

Smidlee
Dec 07, 2005, 05:01 PM
I fear there's something more evil going on here...

If I load the DesertWar scenario, I get a drop from 25-30 FPS to 8 FPS as soon as I zoom out enough to trigger globe view, and that's with just a handful of cities being visible.

Well I get 60 fps on this map until I zoomed out to cloud level which drops to 10fps. ouch! On fully loaded huge maps my framerate varies between 50-15 fps usually somewhere around 25 late in the game but when zoomed out it drops to just 2 fps. Exactly what's in 'em clouds?

P.S with 7800 gt (256mb) card setting graphic on the lowest settings makes no differance in framerate than keeping them on the highest with 4x AA. Got any answers why this is so, Harkonnen?

oldStatesman
Dec 07, 2005, 07:08 PM
Sir, a humble Thank You! :clap:

If you were here in the US I'd buy your drinks all night long!!!! :beer:

My specs: AMD Athlon 2400+ CPU (@GHz) 1GB DDR 333 memory; Windows XP sp2 with 3.6GB page file on separate HD drive/controller; Radeon 9550 256MB AGP Vid card with 5.11 Catalyst Drivers (control panel not CCC)

I re-installed Civ4, applied your patch and did all except lower the settings - left them all on high.

Before the patch, the game loaded okay from the desktop...after it was like greased lighteniing! This was the initial load to the main menu, opening movie etc. The movie ran much better - no stuttering at all...(Windowed Mode)

I loaded your save game, (1961) and it took about 3 minutes to load to the game screen. Without the patch, it took about 5-7 minutes. This was with your default settings, vid_mem_usage = 80. The game scrolled fine; I played a turn and the units moved with little or no lag. Scrolling was fine; even putting the cursor on an edge and letting the world scroll by over and over it never crashed; something it would always do before when I scrolled fast on this save. The only lag was zooming out past the cloud layer - as soon as the cloud texture layer was loaded things slowed to a crawl. The globe view was horribly slow - when I scrolled back in it took a while, but it was like driving a ferrari that I had wound the RPMS up to the redline and shifting gears from first to 3rd as soon as I got past the clouds - it zoomed all the way down extremely fast.

I went through all the diplomacy screens - no memory issues. I gained a lot of memory - however I beleive too much as the vid_mem_usage was set for a 128MB card on Low. The graphics card needed to be used more. BTW, Wonder Movie still stuttered really bad - I believe this is something to do with the way the game runs the Bink codec.

I quit to desktop, and changed the vid_mem_usage to 180. Again, all high video settings for the game. Again it loaded super fast to the Main menu from desktop - this time loading your save game only took a little over 1 minute. (With a cleared cache). Again great performance except for the cloud layer going to globe view. I actually had better memory performance this time...except the page file got a tad larger - but was not accessed much. Overall the game was using only about 550MB of physical RAM, wih virtual memory usage running between 375 and 450 MB, max total paged pool at 819K (compared to 712 with earleir setting).

You should get a new Civver award - "The Golden Hammer" - for tenacity and persistence chipping away at this issue. If you ever want to come to the US and need a professional reference for a job let me know...:goodjob:

Harkonnen
Dec 07, 2005, 07:23 PM
oldStatesman
Thank you! :) Just one thing...
Before the patch, the game loaded okay from the desktop...
Did you mean after the patch...?

I have some ideas about the globe view (simple enough to be coded and checked this night).

Movies are stuttering in civ4 because rendering is still performed in the background when they are played.

Dusty4prez
Dec 07, 2005, 07:55 PM
wait is the third thing even a file? I just get a readme

SCarton
Dec 07, 2005, 08:02 PM
The third thing is an .ini file, not a readme.txt file.

Anyway, Harkonnen, my memory usage dropped from about 770 MB to 424 MB (give or take). I didn't even have to clear the cache first. Great work, and I look forward to the next release. =)

Dusty4prez
Dec 07, 2005, 08:13 PM
I just get linked to this

http://www.sampo.ru/~headden/Patch.v01/Harkonnen.ini

Dusty4prez
Dec 07, 2005, 08:13 PM
it acts like a website.

alexti2
Dec 07, 2005, 08:31 PM
Too bad Firaxis hasn't hired Harkonnen when they've started to work on Civ 4 :(

Harkonnen
Dec 07, 2005, 08:37 PM
Dusty4prez
It looks like your browser treats .ini files as if they were .txt files (Internet Explorer offers to download it).

Here is the link to zipped version of that file:
http://www.sampo.ru/~headden/Patch.v01/Harkonnen.ini.zip

SCarton
Dec 07, 2005, 08:48 PM
He could also just right click and choose Save Link As... from the context menu.

Dusty4prez
Dec 07, 2005, 08:53 PM
Thanks alot

BlueLikeYou
Dec 07, 2005, 09:02 PM
Just got done playing for several hours on my huge modern era game. No crashes at all!! :goodjob:

Using:
graphics settings on medium
low res textures
full screen mode
vid_mem_usage=180
insane_mode=1

System:
Athlon 64 3500+
1 GB RAM
2 x Geforce 6800GT 256MB PCI-express
Win XP SP 2

I might mess around with vid_mem_usage to see if I can get even better performance. What do you think would be a good number for systems using two pci-express video cards in SLI mode?

oldStatesman
Dec 07, 2005, 09:08 PM
oldStatesman
Thank you! :) Just one thing...
Before the patch, the game loaded okay from the desktop...
Did you mean after the patch...?

I have some ideas about the globe view (simple enough to be coded and checked this night).

Movies are stuttering in civ4 because rendering is still performed in the background when they are played.
Before the patch the game would load okay, from desktop to main screen, but it took a while...after the patch it speeds through the initial load. In other words, the initial loading time to Main Menu is greatly decreased. An unexpected bonus...

Something is wierd with the cloud layer texture ...I remember this was one of the things that caused crashes early on before the first Firaxis fix.

Yeah...it's amazing to see the difference in the initial movies before the game is actually run...and the wonder movies.

Harkonnen
Dec 07, 2005, 09:13 PM
BlueLikeYou
With 256Mb of video memory you definitely should try 'vid_mem_usage = 180' or 'vid_mem_usage = 200'. I don't know if SLI cards work in interlaced mode like 3dfx Voodoo did (in this case they share only CPU power) or they share memory as well. You might try 'vid_mem_usage = 300' or 'vid_mem_usage = 400'. Though, all geometry data peak level is ~300Mb, so there is no need to set it to higher values.

oldStatesman
Thanks! I see the point now about "before" and "after".

I am not sure this is clouds layer problem. I'd rather think this is too-much-geometry problem.

oldStatesman
Dec 07, 2005, 09:23 PM
BlueLikeYou
With 256Mb of video memory you definitely should try 'vid_mem_usage = 180' or 'vid_mem_usage = 200'. I don't know if SLI cards work in interlaced mode like 3dfx Voodoo did (in this case they share only CPU power) or they share memory as well. You might try 'vid_mem_usage = 300' or 'vid_mem_usage = 400'. Though, all geometry data peak level is ~300Mb, so there is no need to set it to higher values.

oldStatesman
Thanks! I see the point now about "before" and "after".

I am not sure this is clouds layer problem. I'd rather think this is too-much-geometry problem.
Have you tried Civscale too work with the clouds?
http://forums.civfanatics.com/showpost.php?p=3399385&postcount=222

It's the utility that is partner to BlueMarble Mod. I will try to adjust the clouds with it tomorrow if I have time to play to see if it helps at all.

Sutego
Dec 07, 2005, 10:16 PM
where can i find this 1961 game save file to try out? (forgive me if it is in plain sight and im too lame to see it)

Harkonnen
Dec 07, 2005, 10:31 PM
Sutego
http://sampo.ru/~headden/Harkonnen%20AD-1961.Civ4SavedGame

oldStatesman
Not yet... gonna try it now. BTW, geometry fixes with globe view didn't speed it up. I will try to play with textures.

atomant
Dec 07, 2005, 11:02 PM
It works for me too ! I had tried everything before now in these forums, but nothing worked except this. Intro.bik movie still jerky and I still have the zoom out globe view slowdown described by others but even that is very much improved. Game play is much faster now. Thanks a lot. You are the man.

Specs:
Dell Dim8250 3Ghz 512MB ram
Geforce 4 Mx 420 64MB Yes only.
WIN XP Prof SP1

insane_mode = 1 ( Switching back to game gives me the black map )

I wish I could get my 50 dollars back and send it to you.
Is there something we can do to help with Firaxis on your behalf ?

I know the patch is working, but I didn't see a banner or anything stating your patch was running/active in the game.

Thanks Again.

Harkonnen
Dec 07, 2005, 11:16 PM
atomant
Nice :) I didn't expect insane_mode to work with 64Mb... If you will face problems later (like leader heads corruption), reduce vid_mem_usage down to 32 or better leave it at 50-60 and set insane_mode=0. Again, just in case of trouble... If it's ok now, better don't touch it until then :)

I am changing window title, but that's visible only in windowed mode.

I could not yet avoid a problem with ATI Tray Tools, so I will add FPS meter and memory info into the game, and my banner too (actually just a text).

intro.bik problem is something very strange. I think this is problem with .bik engine. I had similar problem with PainKiller on every 2nd episode ending movie and in some other game, I don't remember which one, but it was year 2003-2004 game. My patch can't fix this since intro movie doesn't suffer from memory usage issues... Probably later I will investigate this matter closer personall for .bik, currently I'm busy with globe view.

oldStatesman
I am currently reading through blue marble thread... and looking for civscale.

So far I see this is not clouds problem. This is cities problem.

1) Start huge map
2) Enter word builder
3) Add all ancient teches (for calendar)
4) Add all modern teches (for satellites)
5) Check the globe.... it's very smooth
6) Now add some 20 cities with distribution close to my savegame (3-4 tiles away from each other)
7) Check the globe.... it's sluggish as hell (with only ~250Mb of memory usage)

Harkonnen
Dec 07, 2005, 11:28 PM
atomant
I wish I could get my 50 dollars back and send it to you. Is there something we can do to help with Firaxis on your behalf?
You all are already doing that by showing me and Firaxis that this patch does work and does solve problems :crazyeye:

I will contact Firaxis this week once I fix globe view problem (or give up doing so).

Harkonnen
Dec 07, 2005, 11:45 PM
I have replaced python24.dll with zlib1.dll:
http://www.sampo.ru/~headden/zlib1.dll

Just the latter is also open-sourced, but 70Kb in size only. Just for the info about mirroring... You don't need to download this one if you seek for any improvement, this comes later... I have also modified original post in this thread.

I thought a little, and came to conclusion that creating aside loader.exe isn't good. Just because civilization4.exe will restart original exe, not loader. Also some people won't be able to fix shortcuts, and I will have to fix .savegame filetype, so that double-clicked savegame loads patched.

Sutego
Dec 08, 2005, 01:40 AM
This patch works for me with your save file. Everything is smooth except for globe view like many have already reported. The delay between turns while waiting for the computer is only around 5-7 seconds for me.

On a side note this is at 1280x1024 full screen mode using 4x AA and all high graphics settings. I set my vid_mem_usage in the ini file to 180. Not sure on my fps but its definately above 30.

My Specs:
P4 519J 3.06GHz @ 533MHz
1.5GB PC3200 (DDR400) Mushkin Black (2-2-2) @ 400MHz
ATI Radeon PCI-E X800XL w/256MB GDDR3, Driver: Omega 2.6.83
Pagefile on separate 200GB SATA150 drive.

TLHeart
Dec 08, 2005, 01:54 AM
Testing your patch with a celeron 2.0 processor, 512meg memory
geforce fx5700 nvidea 256meg

set harkonnen.ini to vid memory to 200
insane mode to 0

get a black screen when alt tabbing between programs from full screen mode, wait about a minute, scroll edge of screen, and the game returns.

This is after using your suggestions...
Loaded my standard map that always crashed, played thru the turn and no crash, no swapping to disk.

using medium graphics settings, no AA.

Loaded your large game file, it is playable, map scrolling works, swaps to disks at times, but seems to be stable with this nvidea card.

player1 fanatic
Dec 08, 2005, 02:28 AM
What would be recommended video usage settings in case of 9000 Radeon (64MB) and 1GB of memory

I think that AGP thing in BIOS is set to 128 for me.

Harkonnen
Dec 08, 2005, 04:01 AM
player1
I'd suggest to try some minimum first:
vid_mem_usage = 32, insane_mode = 1

If there are problems with the above settings, try this instead:
vid_mem_usage = 32, insane_mode = 0

You may then try to increase 'vid_mem_usage' in increments of 10-15 until the game starts to run slower or visual artifacts start appearing.

Tormunda
Dec 08, 2005, 04:14 AM
Harkonnen, your the man. Thank you very much for all your hard work.

I think the Civ community would be very happy if Fraxis either sorted you out a deal or gave you some kind of reward for this.

Until then.... It's a great Xmas gift you have given us all :king:

Smidlee
Dec 08, 2005, 04:37 AM
When I tried to load a save game I get an error message from Harkonnen inc.

player1 fanatic
Dec 08, 2005, 05:21 AM
By the way I'm curious,
While I understand that DX queries need to be turned on...

Why is important to disable Dynamic Animation Paging?

Harkonnen
Dec 08, 2005, 05:32 AM
By the way I'm curious,
While I understand that DX queries need to be turned on...
Why is important to disable Dynamic Animation Paging?

Actually neither of these has any significant effect. DX queries are still a mistery to me, but DynamicAnimPaging should affect a lot, but it doesn't.

I asked to change these values, so that in case we get a lot of bugs, it would be easier to reproduce them at my system in case they are caused by one of these values (dx_queries or dynamic_anim_paging).

Harkonnen
Dec 08, 2005, 05:35 AM
Smidlee
What actually was this error message? A screenshot would be much appreciated!

phalzyr
Dec 08, 2005, 06:18 AM
Just for the info about mirroring... You don't need to download this one if you seek for any improvement, this comes later... I have also modified original post in this thread.
.

OK Won't worry till you get another release :), While at work my T1's max outage throughput went up to 12% It is normally at about 6-8%... :D

Anyway I played with your fix a bit, and it seemed both my computers handled it the same. I had to create my own savegame since my game is heavily modded but if I recall it was same or more than yours memory usage wise...

1152x864 with 2AA and rest high
3.0GHz Dual Core, 1GB RAM, X850xt with 256MB Memory
and 2.66GHZ, 1GB RAM, FX5700 with 256MB
Before = 871M
vid_mem_usage = 80, insane_mode = 0 = 617MB (254MB Gain)
vid_mem_usage = 180, insane_mode = 0 = 643MB
vid_mem_usage = 80, insane_mode = 1 = 543MB (328MB Gain)
vid_mem_usage = 180, insane_mode = 1 = 485MB (386MB Gain)
Dynamic and d3d setting did little, setting to 0AA also did little

Harkonnen
Dec 08, 2005, 06:37 AM
phalzyr
Thanks for these mem-usage logs! I personally liked 386Mb Gain out of initial 871Mb :)

Caledorn
Dec 08, 2005, 07:05 AM
I am very impressed, Harkonnen! Thank you for your hard work on this fix, which works wonders with my late game sluggishness! 5 stars awarded for this thread :D

V. Soma
Dec 08, 2005, 07:23 AM
Hi, Harkonnnen!

I gave your fix a try, and set vid-mem to 64, insane to 1.

I have

Prescott 3Ghz
ATI Radeon 6600

Before you, I could play the game fine but videos were not smooth and game got slow on huge map.

With the fix, in the first turns it went smooth and fast, but then
at the first video it almost stopped, played only a few stills with no sound and VERY slowly, and then after this was what I saw:

What shall I do?

Harkonnen
Dec 08, 2005, 07:29 AM
V. Soma
Try setting 'vid_mem_usage=32' and setting 'insane_mode=0'. How much video memory do you have?

V. Soma
Dec 08, 2005, 07:34 AM
I have 2 x 512 MB RAM

Harkonnen
Dec 08, 2005, 07:41 AM
V. Soma
That's physical memory. Video cards have only recently reached 1 x 512Mb, but 128-256Mb are usual values. I mean memory on your ATI 6600 video board. Or did you mean GeForce FX 6600?

lord_graywolfe
Dec 08, 2005, 07:45 AM
ok i made the changes you suggested and put the Harkonnen.ini in my game folder. i loaded a saved game from 1780 that i had given up on due to the graphic problems every turn. it looked perfect, i ran it for a turn opened up all the advisor windows, which usally caused it to go black and it still stayed normal. i cant believe i can actually finally play the game without having to reload every turn. i havent seen what will happen with an in game movie or when a leader head pops up yet but if it still holds after a few turns and those pop ups it will be awsome thanks Harkonnen.

oh by the way when i tried to download the first 2 fills on your first post they wouldnt do anything as my system says it can not open them.

Harkonnen
Dec 08, 2005, 07:49 AM
lord_graywolfe
Probably some firewall-alike software prevents you from downloading EXE/DLL. So, did you download them or not? Just placing single Harkonnen.ini does nothing at all...

V. Soma
Dec 08, 2005, 07:53 AM
I see

the video is 128 MB - ATI Radeaon 3D 6600

Harkonnen
Dec 08, 2005, 08:02 AM
V. Soma
So, please reply

1) Have you managed to download zlib1.dll (or python24.dll) and PatchByHarkonnen.dll and place them into Civilization IV folder?

2) If the answer to (1) is YES, did you try 'vid_mem_usage=32', 'insane_mode=0' in Harkonnen.ini to avoid that graphical problem?

V. Soma
Dec 08, 2005, 08:05 AM
Well, with settings

vid_mem = 32 and Insane = 1 it seems to be OK so far! :)

Buddhism video was played fine,
and the grid was on pretty fast on a large map.

After playing like 25 turns,
memory usage is 300 MB,
with all graphics set to max (AA 4, all high)

Colonel Kraken
Dec 08, 2005, 08:26 AM
This looks like great stuff, Harkonen. Are there some files I need to back up before applying your patch? What if I wish to "uninstall" your patch?

Currently, I run the game on Medium settings, and it runs quite well (small delays here and there, some stuttering video, etc.). Would your patch help me?

My Specs:

AMD Athlon 1900+
512MB PC133 RAM
ATI 8500LE 128MB card

Harkonnen
Dec 08, 2005, 08:42 AM
Colonel Kraken
Currently there is zlib1.dll being replaced (it's changed only to load PatchByHarkonnen.dll), so you may want to back it up.

A day ago I used python24.dll to perform DLL injection, but that one was much bigger.

If you didn't make a back-up, check http://www.sampo.ru/~headden

There are Python.Original and zlib.Original folders with original versions of those DLLs coming when civ4 is being installed with 1.09 patch.

You may also set 'patch_on = 0' in 'Harkonnen.ini'. In this case my DLL will still load via zlib1.dll (or python24.dll), but it will do nothing at all.

Also note that in case Firaxis releases their next patch soon (and in case my patch won't be in it), you will probably have to replace zlib1.dll again.

Harkonnen
Dec 08, 2005, 08:53 AM
Mirror kindly provided by phalzyr has been updated with zlib1.dll approach. It's given in updated post #1. No changes to patch itself so far, just replaced 3 files with 1 zip, 48Kb in size.

Joebasalt13
Dec 08, 2005, 09:08 AM
Ok I tried running the game without configureing the setup thing. The opening game loading time doesn't seem to have improved. But the time between turns seems to have cut in half! It used to take 5-10 mintutes between turns now between 2-3. So thanks! I have a few questions though.
First here are my system specs incase you need them.

Intel (R) Pentium(R) 4 CPU 2.93GHz
504mb Ram
160GB hard drive
Directx 9.0c
Intel(R) 82915G/GV/910GL Express chipset

Now my questions are...
1. You say to edit the configuration in the Harkonnen.ini file. The three files I downloaded have the file names python24.dll, PatchByHarkonnen.dll, and Harkonnen. Underneath the Harkonnen one it says Configure setting so I assume that is the one that is supposed to be the ini one. It says access denied and is not able to open in notepad or any other program. Is it incorrectly downloaded? Or what do you think is the problem?

2. Does it matter to your patch whether or not I keep it in windowed mode? Or can I return to full screen? The moving around the map with the control buttons is annoying.

3. While in windowed mode I watch the memory used in Windows task manager and it jumped between 300,000k and 360,000k What does that mean? Is that good or bad?

4. Finally I was going to get some more Ram to boost it up to a gig will that help the loading times for my game?

Thanks Harkonnen for your help!

Harkonnen
Dec 08, 2005, 09:26 AM
Joebasalt13
1. Probably some antivirus software prevents you from editing 'Harkonnen.ini' or something keeps it open. You may try also download .zip file (check post #1 again, I've modified it several minutes ago).

2. It does not matter, but if you use 'insane_mode = 1' (Harkonnen.ini), you might have problems when alt-tabbing back into game. Most people get black map until it's updated, but I think this can lead to more serious problems. Basically, if you plan to alt-tab oftenly in full-screen mode, you should use 'insane_mode = 0', but this assumes that you can edit it...

3. 360Mb is something maximum when it fits 512Mb without swapping, but later in your game you will probably need more RAM. Also, 'insane_mode = 0' needs 80-100Mb more RAM, so to make 'insane_mode = 0' transition without loosing performance, you will surely need that upgrade. And after all, most games today require 1Gb to play well...

Joebasalt13
Dec 08, 2005, 09:46 AM
Ok I downloaded the ini file again and now realize what the problem was I can edit the file when it is on my desktop but when I place it in my WindowsPrefetch folder (Where my Civilization.exe file is) it won't let me edit it. Anyway As you probobly know My graphics card does not have TnL but I have never had problems with the graphics. I started off played on the highest graphic settings and all animations on and it worked fine. Other then the incredably slow load times. A couple days ago I switched it down to medium hoping it would be faster. My new question is If I wanted to run my game on Full Screen, with either Medium or High settings, Low Res Textures, but all the unit animation ON what would you recommend I set the things to. I don't alt-tab out of it ever I never knew you could. LOL When I want to check how much memory it is using I hit the windows key that opens the start menu.
Anyway thanks for the help.

Harkonnen
Dec 08, 2005, 09:53 AM
Joebasalt13
Prefetch folder is internal Windows stuff, you are looking for Civilization4 in the wrong place.

Extract all 3 files into folder where you have installed the game. If you do not know where it is, most probably it is located at "C:\Program Files\Sid Meier's Civilization IV\" or something like that. You may also scan your hard drive for 'Civilization4.exe' and pick location which looks like that, but NOT prefetch folder :)

Harkonnen.ini and two DLLs (zlib1.dll or python24.dll) and PatchByHarkonnen.dll should all be placed in that folder, overwriting existing ones.

I recommend trying 'vid_mem_usage=40', 'insane_mode=0' for starters. If it runs fine, you may try changing 'insane_mode=1' - it should become better, but it might impose graphical bugs as well, even without alt-tabbing.

This patch is about memory-usage issues. The fact that it solves black terrain and CTDs is just an unexpected bonus, my aim was to reduce lags in the late game, so that seems what you are looking for... just follow the instructions above :) Good luck!

Stone-D
Dec 08, 2005, 09:59 AM
First, ultra-high kudos to you Harkonnen. One of the few real asm coders left, I reckon. God I miss Iczelion!

Second, Joebasalt13: You're in the wrong folder! If Civilization4.exe is in your windows prefetch folder, something is very wrong. The file you *think* is civilization4.exe is probably about 60-80 kb, right? You want one that's 11 megabytes.

If you really want to find anything on a windows box, stop explorer from hiding filename extensions.

Windows Explorer ->Menu "Tools" -> Folder Options -> View -> "Hide extensions for known file types"

UNCHECK THIS.

Stone-D
Dec 08, 2005, 10:04 AM
With regards to overwriting original files, I am strongly against this. Instead, I suggest renaming, for example, python24.dll to python24.dl_ ... that way, come patch time, you don't need to fuss around with reinstalling and all that.

Harkonnen
Dec 08, 2005, 10:07 AM
Stone-D
I didn't say that because those who are fluent with manually copying/overwriting files will do so anyway... Those who are not (I don't want to offend anyone), will just get more confused.

Stone-D
Dec 08, 2005, 10:35 AM
Ah, yes... true enough. Dammit I should hit the sack, brain not functioning per spec. ;)

phalzyr
Dec 08, 2005, 10:38 AM
hark: just a suggestion by since it is so much smaller with zlib why not do rename for us... I.E. include the original also, already renamed :)

Or I guess just put it up as seperate download for when patch time does come we can dload it if we forgot to rename it. ;)

MetHimPikeHoses
Dec 08, 2005, 10:49 AM
Harkonnen, nice job. I finally can play on a huge map w/o huge wait times inbetween turns. At least at the outset of the game, there is only a 1-2 second wait inbetween. Amazing.

CeleryD 2.4
1GB
fx5200

Harkonnen
Dec 08, 2005, 11:27 AM
phalzyr and all
Post #1 updated. Bottom of the post now contain links to original 'python24.dll' and 'zlib1.dll' in case you want to restore them back.

phalzyr
Dec 08, 2005, 11:30 AM
BTW HARk I just looked at ATI website and they have 5.12 drivers out :D

BlueLikeYou
Dec 08, 2005, 11:38 AM
As I understand it, Nvidia SLI cards don't share memory. So in my case, each GPU has 256 MB.

I gave it a shot with vid_mem_usage=400 anyway, just to see what would happen. It ran fine, but there didn't seem to be a difference between that and with vid_mem_usage=180. On one of my save attempts however, I got a memory allocation error (like the one in the "memory leak?" thread). Not sure if that was the cause or not. I'll probably drop back down to vid_mem_usage=180 or 200 and see if that error ever comes up again.

Woody
Dec 08, 2005, 12:01 PM
Just adding my 2 cents, I have a decent enough speced system that game speed was not a big factor but I was getting random CTDs late in the game on huge maps. After using this patch I have not had a single CTD yet playing on a huge map after several hours of gameplay.

Athlon 3200+
1 gig ram
6800GT 256mb vid
silly amount of HD space

Kolyana
Dec 08, 2005, 12:04 PM
Hark' ... you are a genius man with the tenacity of a pit bull ... I commend you! :notworthy:

You have, I assume, made oyur findings know to Firaxis? To my mind, they should be paying you for what you've done here (which is clearly more than their entire programming team).

Harkonnen
Dec 08, 2005, 12:08 PM
Kolyana
Woody
Thank you! :D as for pit bull - yes, I'm aries...

Kolyana
Dec 08, 2005, 12:17 PM
Harkonnen, I may have found a (none critical) problem ...

I used to be able to double click a saved game from within outlook, which would fire up civilization with the load in question (typically used in PBEM games).

Doing this now, however, causes a "Error Opening Harkonnen.ini!"

I tried moving said file to my desktop and got the same error ... so I would conclude that i can't open a game by double clicking a save anymore with this patch installed.

Stalin_Bulldog
Dec 08, 2005, 12:31 PM
Ahem sorry for wasting post space w/ praise, but harkonnen, you are the man, i am a cs student, in school right now, and i never even would've dreamed of doing something as massive as this, it works great on my machine, and congrats on beating firaxis :}

lord_graywolfe
Dec 08, 2005, 12:38 PM
well Harkonnen i disabled the firewall but i still cant open them. i can download them but it says windows can not open dll file so i havent been able to use them, i had similar problems with the art pack fix they posted that didnt work for me either lol. well something in your setting adjustments sure worked for me cause its going great with no problems at all except for the in game movies being a bit jerking but i can live with that

phalzyr
Dec 08, 2005, 12:42 PM
Lord_graywolf... umm you are not suppossed to open them just save then to your civ game folder...

Joebasalt13
Dec 08, 2005, 12:46 PM
Um... Well I rechecked and my Civilization4.exe file is in the Prefetch folder. I am ok with that cause I got you patch to work and my game is playing great now. I finished (First time ever) my game that was at the year 1970 in around 2hours which is about as long as it took for 10 turns before. Also the movies are perfect now no stuttering or anything. My hotseat game is still a little slow but that is probobly because there are two humans and needs to load twice as much stuff. I will be getting another 512mb ram either this weekend or next week so hopefully that will help.

But thank-you Harkonnen I actually finished a game which is something I never thought I would. (I lost by the way. They called me Dan Qualye. I think that is bad LOL)

lord_graywolfe
Dec 08, 2005, 12:53 PM
ok well that i was able to do, downloading them was never a problem its when i would get a message saying open with default something or other when i would click continue i would get the error message. but they were already downloaded so its all good thanks.

rebby
Dec 08, 2005, 02:02 PM
Another thank you to Harkonnen for your great work.

I can play for longer now between crashes but I still get CTDs. Do I have to replace the python24.dll or is the original one (post 1.09 patch) ok?

(Athlon 1800+, 1GB, 6600GT 128MB, standard terra map, hotseat, 2 humans, 7 AI, late-middle game, vid_mem_usage 64, insane_mode 1, low for all settings, 1024x768, no AA)

EmilH
Dec 08, 2005, 02:25 PM
Great work Harkonnen !!! Civ4 is finally playable.

Just want to say that before I installed your patch, I got a huge performance boost by setting AllowScreenShots = 0 in civ4.ini. Don't know if this was only a lucky shot, but it helped me (ATI9600). It's even commented as performance affecting (and how often are you really taking a screenshot???).

Why weren't you around when I tried to get CivNet MP to work on Windows 3.11 when that game was released? :) I bet you could patch that one as well :D

Kilim
Dec 08, 2005, 02:29 PM
I am happy to say that this helped on my work PC to be able to load and run HUGE Maps w/ 18 Civs!
Loaded an old game that would CTD and/or slowdown during the Industrial Age and w/ this fix it runs decent on my work PC.
It even improved the performance on my Home PC as well!

But I try the same fix to my Home PC and was hoping to be able to bump up the settings more due to thinking its a better PC and not get the results I was hoping for.

Heres my PC Setup:

Both PCs:
HarkFix: All Default Settings
Graphics: All Set on Low
Windowed Mode
.INI File Modified
ART PAK unzipped
Work PC:
P4 3ghz
1GB RAM
GeForce FX5600XT 256mb RAM



Home PC:
P4 2.4ghz
1.7GB DDR RAM
ATI X850XT 256mb RAM


I was thinking that I should be able to run my Home PC w/ at least vid_mem_usage=180.
But when I do that the game would CTD when I load a HUGE Map w/ 18 Civ game that is in the Post Industrial Age.
It still runs PERFECT if I leave the settings in Default.

I know I am going to have to just to run it at Default settings for now but I am really thinking if I can tweak it to run better :D

Any Ideas?

Briareos
Dec 08, 2005, 02:31 PM
I tried moving said file to my desktop and got the same error ... so I would conclude that i can't open a game by double clicking a save anymore with this patch installed.
I'd hazard a guess that the patch files are looking in the current directory for the INI file, which in the case of double-clicking a file in Outlook would be somewhere in the depths of a "Temporary Files" directory.

The game itself most probably gets it's install location from the registry, so it'll find it's files in any case, and of course the Civilization4.ini file is in your profile, which also is at a fixed (or easily found out) location.

Checking "HKEY_LOCAL_MACHINE\SOFTWARE\Firaxis Games\Sid Meier's Civilization 4\INSTALLDIR" and using that when looking for the INI file should fix it... :)

np: Eric B. & Rakim - Paid In Full (Paid In Full)

Kolyana
Dec 08, 2005, 02:44 PM
Briareos, I'm not sure I understand you.

Prior to installing Harkonnens fix I could click on a civ saved game file form any locaton and it would open Civilization and load that save automatically.

Now - after Harkonnens fix - that no longer works.

Celaborn
Dec 08, 2005, 03:26 PM
I also have found the same problem as Kolyana, in that I used to be able to double click a civ4 save, no matter where it was(if I just downloaded it from the internet onto my desktop, say) and Civ4 would load up straight to that game automatically. Now it just gives a 'Error Opening "Harkonnen.ini"!'

Not a major problem by any means, just noteworthy.

Smidlee
Dec 08, 2005, 03:59 PM
Harkonnen, I may have found a (none critical) problem ...

I used to be able to double click a saved game from within outlook, which would fire up civilization with the load in question (typically used in PBEM games).

Doing this now, however, causes a "Error Opening Harkonnen.ini!"

I tried moving said file to my desktop and got the same error ... so I would conclude that i can't open a game by double clicking a save anymore with this patch installed.
That's was my problem too (that I posted earlier) until I realize I had to run the game first. I was loading saved games from the desktop.

Also if I exit the game and reenter my map turn black excepts cities and farms. Sometimes it crashes if I reenter a game.( I haven't been playing from the window mode though)

oldStatesman
Dec 08, 2005, 04:11 PM
The file type association probably points to the original Civ4 files. You may be able to fix this by putting the Civ4 folder containing the file that it is looking for in your 'path'. The Operating system must know where to find a file...the 'Path' statement will tell it.

To do this, right click on 'My Computer", select properties. Select the Advanced Tab\Environmental Variables. Under System Variables find the "path" statement. Click Edit. (Use caution - do not delete anything that is there now!!!!) At the end of the Variable Value line add the path to your Civ4 game files. For example, mine is G:\Firaxis Games\Sid Meir's Civilization 4. Substitute your info....be sure to put a semi-colon at the end of the existing line before typing in the new info...and again, do not delete any of the old line...just add your info to it. Click 'Okay" all the way out to the desktop, and re-boot.

Not guaranteeing this will help...but at least you maybe have learned a little thing about Windows and the path ;) ...I tried it and it did not work...but I may need a reboot for it to hold - I cannot reboot right now.

Otherwise Hark may have to add something to his dll code to compensate for this...maybe something to do with the copy protection stuff...

Harkonnen
Dec 08, 2005, 04:24 PM
All
Yes... I didn't check for main executable folder when I load .ini file, so it looks in the current folder which can be "whatever" when you double-click savegame, this will be fixed.

Kilim
First of all, try 'insane_mode = 0'. If it helps, try downloading 5.11 ATi drivers and 'insane_mode = 1' again. If you are already with 5.11, then 'insane_mode' doesn't work for newest ATi cards... Though, their 256Mb of video memory should make it very-very playable, especially in 1Gb RAM configurations even under 'insane_mode = 0'.

Smidlee
Crashes upon reentering the game can be solved by setting 'insane_mode = 0'. That's why I named it insane... It improves memory usage at the cost of stability, especially alt-tabbing stability.

lord_graywolfe
I think next version will come with installer, so you won't have those problems...

oldstatesMan
Thanks for comments but that won't help :( I just 'fopen' that file. I will release installer with this thing fixed before globe view fix since that one gonna get more time.

Harkonnen
Dec 08, 2005, 04:36 PM
P.S: As for me (9800 Pro) disabling screenshots didn't improve anything.

Kolyana
Dec 08, 2005, 04:38 PM
Globeview fix?

oldStatesman
Dec 08, 2005, 04:49 PM
Yeah, I thought my solution above was barking up the wrong tree...but oh well... ;)

BTW, I posted about your patch on Apolyton...here is the link:
http://apolyton.net/forums/showthread.php?s=&threadid=145207

Hope you do not mind....

Harkonnen
Dec 08, 2005, 05:34 PM
oldStatesman
Thank you...

But I am currently carrying it over in this thread :)
http://apolyton.net/forums//showthread.php?s=&threadid=145105

Harkonnen
Dec 08, 2005, 05:38 PM
Can you name some other forums as big as CFC/Apolyton?

BTW, I think CFC gonna increase its audience a lot if all of them link here through this patch...

I don't mean to advertise CFC as the forum on its own. I mean to praise community which inspired me to write this :)

Harkonnen
Dec 08, 2005, 05:42 PM
Kolyana
Yes, the "globeview fix". The globe in huge game is veerrrry slow. Before my fix I thought it's due to swapping, but now I see it has some other roots, so I am willing to fix that too.

Colonel Kraken
Dec 08, 2005, 06:59 PM
I wanted to give you my amazing report, Mr. Harkonnen.

I applied your patch and inititialized everything as you suggested (all low settings, etc.). I loaded a game and zoomed in and out and ran through a turn of a saved game. As usual, motion was jerky and transition from normal to global view was highly delayed.

I then bumped up to "Medium" in game settings (which I played on prior to your patch). The results were the same, more or less. I exited the game and bumped up vid_mem_usage from 80 to 120.

I re-started the game (several times I had held down the [Shift] key to re-fresh the cache). The opening video was almost totally smooth! I then went into my saved game and tried global zoom out (back and forth a couple of times). Almost instantaneous! :eek: (before, it would take several seconds to transition).

Ending the turn, I received yet another surprise: the turn took approximately 1 second to calculate (before: ~5 seconds). Woah!

I am totally bought and sold on your patch, Mr. Harkonnen. Way to go! :goodjob:


My specs:

AMD Athlon 1900+
512MB of PC133 RAM
ATI Radeon 8500LE with patch 5.11 (AGP 4x)

My Settings:

patch_on = 1
vid_mem_usage = 120
insane_mode = 1


Thank you, sir.


EDIT: Another thing I just noticed: entering the various menus ([F1], [F5], etc.) is almost instantaneous! Before, I would have to wait sometimes for several seconds to get the information for these advisor screens! :eek:

Oh, by the way: Exit to desktop is superfast now (as opposed to super slow before!). :D

oldStatesman
Dec 08, 2005, 08:03 PM
Can you name some other forums as big as CFC/Apolyton?
Not too many...I hardly have time to read and post here ;) ...I do read Apolyton, but never posted until today.

I have been to quartertothree.com - it has a few Civ forums - check the games section; I know Soren sometimes posts there...and check out the links page here on the main site....there are several forums listed there...
http://www.civfanatics.com/links/

Kilim
Dec 08, 2005, 08:04 PM
Thanks Hark.
I shall try the 'insane_mode = 0' on my Home PC w/ the ATI x850xt Vid Card when I get home tonite.

On a good note for your reference.

I Upped the settings for my Work PC.
I put the 'vid_mem_usage = 80' to 'vid_mem_usage = 180'
No problems so far and I belive it actually improved the Game!

I prefer to play in Huge Terra Maps w/ 18 Civs.
Maxxing it out to make it semi-realistic when it comes to dealing w/ alot of different Civs to Rule the World Agaisnt.
I can even actually have my Web Browser, 1-2 programs and Civ4 running at the same time w/ no CTD or slow downs on my Work PC now :D

But ya, Why I find it interesting that my Work PC is soemhow running Civ4 Better than my Home PC lol
but liek I said I will try those changes in the INI file and hopefully improve my gaming on my Home PC even better :D

Fallblau
Dec 08, 2005, 08:48 PM
Leave it to me to be the difficult one... :)

OK, the patch actually seems to increase my memory usage... But, to be fair, I decided I would test it at the settings I normally play at, which would be 1280x1024, 4xAA and all set High...

I loaded the 1961 save pre-patch, and got 367,332 used by Civ's exe, with a 1.05 gig pagefile, for a total of 1,367,332 in combined usage...

Put in the patch, set insane_mode = 0 and vidmem = 64, as you suggested with High res, loaded the save, and got 573,824 used by Civ's exe, with a 940meg pagefile, for a total of 1,513,824 in combined usage... a 150meg increase...

I was going to try changing things around with vidmem and such, but every time after the first that I loaded the savegame, I got the "black terrain" and "white-box text" problems that many early ATI users reported, which is odd since I run an Nvidia 6600GT...

And, as you suspected, alt-tab and fullscreen definitely did not play well together...

Oh well.... Either I broke it, or for some odd reason my machine likes the 1.09 patch really good... :) As a side note, I was running a newer version of zlib and python24 than what shipped with Civ anyway, so that may have had some effect...

For the record:
Athlon XP 2600+ running at about 1.9GHz
1.5gig Ram
XFX Nvidia 6600GT w 128 vram
AGP aperture set to 128

Colonel Kraken
Dec 08, 2005, 08:51 PM
Try holding down the [Shift] key while the game starts/initializes after you have change (increased) our vid_mem amount. See if that works. That was the key for me.

Thunderfall
Dec 08, 2005, 09:52 PM
I just posted a news post about it on the main site. Thanks for your hard work, Harkonnen. :thumbsup:

ainwood
Dec 08, 2005, 09:59 PM
Can I ask why you replaced the zlib compression library?

Edit - I see - you use it to load your DLL.

Kilim
Dec 08, 2005, 10:15 PM
Ok I just got home and changed the Insane Mode = 1 to insane mode = 0.
I still get a CTD when I load my Huge Map game w/ 18 Civ at 180 Vid mem.

SO far I can only make this fix work on default settings on my Home PC.
Guess I am trying to max my system beyond what it can.
Just I tought it should be able to handle more considering my work PC is not as good as my home PC yet the work PC can be pumped up a little more.
Work PC:
P4 3ghz
1gb RAM
GeForce FX5600xt 256mb

patch_on = 1
vid_mem_usage = 180
insane_mode = 1

Home PC
P4 2.4ghz
1.7gb DDR RAM
ATI x850xt 256mb

patch_on = 1
vid_mem_usage = 80
insane_mode = 1
Just disappointed me I guess :(
Weird that I can set the Work PC at a higher setting and not my Home PC.

But I still love this fix :D
Definitely improved performance!

jupiterkris
Dec 08, 2005, 10:36 PM
my pc specs -
Asus P4P800 Motherboard
P4 2.4 GB Processor
Triplex Parasouls 9200 SE Video Card (128MB)
1.2 GB RAM

fixed with Harkonen memory fix -
jerky opening video
freeze crashes with large save files

:D :goodjob: Thank U Harkonen

groobz
Dec 08, 2005, 10:39 PM
Harkonen, thanks mate, my game is less jerky now!

i have a 2400ghz, 1gbram, 64mb graphics,, and i set my vidmem usage to 40. Is that ok? what would be the best setting for a 64mb card?

panzooka
Dec 08, 2005, 10:58 PM
disable cities in global view, see if it helps

Harkonnen
Dec 08, 2005, 11:07 PM
oldStatesman
Thanks, I will follow your link.

vibsanghi
Dec 08, 2005, 11:23 PM
hi i was wondering can this patch be applied for 64 MB video cards i have Geforce 4 mx 420 with 512 MB ram

Flash1
Dec 08, 2005, 11:38 PM
I have an HP Computer.
Specs:
AMD Athlon 3200XP;
768 MB RAM (Virtual Mem set to 4096MB);
GeForce 3 Ti 200 64 MB Ram;
Win XP SP2;

What settings should I use?

Harkonnen
Dec 08, 2005, 11:44 PM
vibsanghi
Yes, some peple with 64Mb reported it is working, though you will probably need to set 'vid_mem_usage' to 32 to 40 (by default it's 80).

Flash1
Yes, same as above...

seta_san
Dec 08, 2005, 11:50 PM
Looks good, might give it a try.

Has Firaxis replied to you yet Harkonnen?
I'm curious to their response.

Flash1
Dec 08, 2005, 11:54 PM
What is "insane mode" ?
Am I better off in Windowed mode?

EmilH
Dec 09, 2005, 12:05 AM
Just I tought it should be able to handle more considering my work PC is not as good as my home PC yet the work PC can be pumped up a little more.
Work PC:
P4 3ghz
1gb RAM
GeForce FX5600xt 256mb

patch_on = 1
vid_mem_usage = 180
insane_mode = 1

Home PC
P4 2.4ghz
1.7gb DDR RAM
ATI x850xt 256mb


Hmm, reading your specs, I would say you have a better computer at work! 3GHz CPU compared to 2.4GHz at home. Both computers has enough mem so that should not be a problem. How the graphics card compare I don't know, but I think that on a huge map, more CPU is prefered than more GPU. A 1280x1024 screen shouldn't take more time to render on a huge map compared to a small map, it's still the same amount of graphics.

Harkonnen
Dec 09, 2005, 01:11 AM
Flash1
"insane_mode = 1" might be problematic in full-screen mode with freuquent alt-tabbing (switching tasks). In windowed mode it is more tolerant to task-switching.

"insane mode" uses video memory to extend memory usage of civ4 used for graphics. Without insane mode almost every bit of video memory is backed up by system memory.

Video memory is not kept by Windows like physical memory is swapped, so alt-tabbing might kill game graphics data without recover possibility (only for insane_mode).

Harkonnen
Dec 09, 2005, 01:18 AM
Fallblau
Page file size doesn't show exact virtual memory usage. Virtual memory tab in task manager shows that per-process (this column must be explicitly added, by default it's not shown).

I think you should try following settings:
insane_mode = 0, vid_mem_usage = 80

Also note that game might swap for the first time you see some land or some country, but optimizations made by my fix allow more data to stay in memory than without my fix, so system swaps less.

For example, 1Gb systems should experience no swapping at all.

Also please read post #1 again (I made update about zlib1.dll there). You *MUST* download it not because I made some improvements to zlib1.dll (I didn't), but because it loads PatchByHarkonnen.dll into civilization4.exe process. Same stands for those who used python24.dll earlier.

All
Previous paragraph about zlib1.dll does not affect those of you who have already downloaded and replaced it.

Harkonnen
Dec 09, 2005, 01:22 AM
Kilim
Try setting 'insane_mode = 0'. I saves a lot of memory, but at cost of some performance (not to mention stability). Probably GF imposes less performance penalty than ATi. You have at least 1Gb in both configurations, so 'insane_mode = 0' should work fine for you.

kettyo
Dec 09, 2005, 01:48 AM
Dear Harky!

Could you tell me what this setting actually do?

"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"

I don't understand what d3dquery and dynamicanimpaging is at all, sorry :)

kettyo
Dec 09, 2005, 01:55 AM
Harky!

The hugesave-testfile is not downloading for me.
Could you please attach that in a post?

jegui
Dec 09, 2005, 02:42 AM
Hi Harkonnen,

I've been following this thread with some interest since all my civ crashes are caused by civ4 handling memory usage. I can't play huge maps without crashes after 2,3 turns in advanced eras...

Anyway I applied your patch and unfortunately the game crashes this time when I zoom in/out and scroll in world view... Memory handling and speed are much better though!

My sys spec:
P4 - 2.6mhz, 1Gb mem, nvidea FX5200-128Mb, 80 Gig disc, XP Home SP2

I tried the following settings in Harkonnen.ini:

1) patch_on = 1, vid_mem_usage = 80, insane_mode = 1
2) patch_on = 1, vid_mem_usage = 80, insane_mode = 0
3) patch_on = 1, vid_mem_usage = 70, insane_mode = 1
4) patch_on = 1, vid_mem_usage = 70, insane_mode = 0
5) patch_on = 1, vid_mem_usage = 100, insane_mode = 1
6) patch_on = 1, vid_mem_usage = 100, insane_mode = 0
7) patch_on = 1, vid_mem_usage = 60, insane_mode = 1
8) patch_on = 1, vid_mem_usage = 60, insane_mode = 0

The game loads fast and for all the above settings it CTDs when I zoom out... Game graphics are set to 'High' except for Textures which is set to low and I ticked low res texture option.

Do you think my PC is not compatible with your patch? What do you recommend?

Cheers!

Stilgar08
Dec 09, 2005, 02:47 AM
:hmm: I don't have any big issues with civ4 now and usually I'd say: Never change a running system, but I want to try since occasionally my wonder-movies stutter and its always good to improve performance!

My specs:
AMD Athlon 3000+
NVidia GeForce 6800GT 256MB RAM
1 GB Ram

- Settings? (Will go for default if you're too busy - I'd understand!! :) )

I'm @work right now and will install it later. One question: How do I uninstall this, if it doesn't work?? I read something about it, but I didn't get it... :blush: (I'm a moron, when it comes to modding...)

Thanks for your hard work! It definitely is appreciated :thumbsup: (haven't seen a thread growing THAT fast in a while :eek:) :)

Awomaru
Dec 09, 2005, 02:49 AM
Hi Harkonen,
I've just registered only to tell you that your patch works perfectly for me! No problem with installation - I've just followed your instructions.

It must be kind of magic: I couldn't play Greek World scenario before (only few extremaly slow turns with forzen screen at the end) and now it runs well and smothly - I'm 50 turn befor the end of scenario!

Man, you ARE great! Thank You!

PS. It's so STRANGE that Firaxis couldn't fix it...

The Spac
Dec 09, 2005, 03:18 AM
Installed it and it worked great. I backed up the lib.dll to be safe. :) Runs at least 50% better. Excellent work.

Amazigh
Dec 09, 2005, 03:22 AM
Hakanon :goodjob:
I have only registered too thank you because you have fixed this (in)famous memory leak bug.
Thank you very much I have droped this game due to too many bugs, the memory as one of them Firaxis have totaly neglegted that the bug even exists. You have proved that they need some skiled employes and I hope that they gonna pay a huge amount of money for this fix.

Hakanon I hope you can help me with another bug that is really annoying:
My screen sudenly goes in sleep mode (no signal too the monitor) and i have to restart the PC. This happens only when i play CIV4. It takes anything between 1 turn too 20 turns before it does this. The problem is less frequent when I downclock my graphic cards.
My system specs:

geforce 6600GT
amd 2500
2x512 mb ram

I really hope you have an idea of what is wrong, I have read of other geforce owners with a similar problem.

mr. Y
Dec 09, 2005, 03:26 AM
amazigh:
I experienced the same thing, nut only after I have been playing for quite a long time on a complex map. I contributed it to my videocard becoming overheated. My PC seems to continue running, so I think only the videocard stopped performing.

Halk
Dec 09, 2005, 03:29 AM
Harkonnen. I've a 256MB video card and 2GB of RAM.

Currently not playing Civ4 since I'm waiting on an 3Ghz Opteron to arrive this morning so I can increase my speed just a little.

Is it worth using your patch, or from what you've learned from working with Civ4, should it be able to play without paging on my setup?

Edit : Should say that with 1GB I was having problems, and I haven't had a chance to play Civ4 since I went for 2x1GB sticks.

Jove
Dec 09, 2005, 03:42 AM
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.


wow. I'm finally up to 1Gb and a 256Mb gfx card, and I think it runs very well. I can't wait to check out a 'more playable' Civ4. :crazyeye: What would that even mean?

JackTheNarrator
Dec 09, 2005, 03:44 AM
Well as this patch seems to be a major fix, you should contact Firaxis team... So they can fix the memory leak in the next patch...

BTW, you should also claim a job at firaxis support section :)

gusten
Dec 09, 2005, 03:48 AM
Well, I just want to say that I really loath firaxis. They should have been the one to distrubate this patch.

I hope Soren and the guys read this. I want firaxis to give half of my paid money to Harkonnen. Hi's doing what Firaxis should have done before thay realeased the first version. I belive that the programming skills of the Civ4 staff could be better. Well, this was the last Firaxis game I bought.

Finally i'm tierd of the PC as a gaming platform. Every time i buy a game for the PC there is always some problem, Civ4 is extremly bad.

Maybe Civ 5 will not come to PC at all. I am really hoping that XBOX360 with the new HDTV format will make stratagy games on other platforms than PC possible.

I want to relax when I play. I will not tolerate worrying about the next crash or the annoying studering movies.

Amazigh
Dec 09, 2005, 03:48 AM
amazigh:
I experienced the same thing, nut only after I have been playing for quite a long time on a complex map. I contributed it to my videocard becoming overheated. My PC seems to continue running, so I think only the videocard stopped performing.
Could you please post your system specs? Yes it is a graphic cards issue, I don't think its a heat issue because the computer will restart if it was, not go in sleep mode. And i can play doom 3 and far cry for many hours with out experincing any heat problems

calyth
Dec 09, 2005, 03:51 AM
Thanks!
I can actually load a busy Huge map now!
so it turns out around a triangle per every 3-4 pixels
Aie.......

Very nice work! Hope they'd actually figure what you've done, give you credit and incorporate it in the next patch. And they better give you a big credit.

Defectiv
Dec 09, 2005, 03:58 AM
Wow, what a difference! My game doesnt run smooth yet but thats probably my Ti4200 with only 64mb's fault. But no more minute long freezes at the end of a tick (and at random moments from time to time), and so far no CTD, so overall a GREAT improvement :)

Running P4 2.4ghz, 1 gig mem and a GF4 Ti4200 64mb
Soon the 4200 will ge replaced by a GF6800 so that should fix the low FPS in scrolling.

kettyo
Dec 09, 2005, 04:03 AM
I've also checked out the patch.

I have a Clevo laptop with 2Ghz Pentium-M, 1GB RAM, 256MB X800XT Mobility video

With the 'safe' setting of vid200 it spared me 126MB RAM and the insane mode 115MB more.

But both settings slowed my in-game scrolling speed down (i'm using 1680×1050 res, 2×AA, max detail)

The insane mode slowed the map scrolling very much but even with insane disabled it got slower.

So for now i've disabled your patch but i'm awaiting new developments to be able to play a huge/18civs game without crashing (i think it's able even now with the patch just i have a good large/9civs/epic game on the way with i'm on the lead :-)).

A lot of gratulations for your efforts and success at reducing memory needs for this game!!!
Checking further developments...

JadeDragon87
Dec 09, 2005, 04:05 AM
Hi Harkonnen
I installed your patch and must say it works well for me. I couldn't load a huge map before, and with your patch I started playing on a huge map. Now I just see how far I'll get. But on a large map it should work perfectly for me. It will be a huge change for me after playing on standard map size.
Thanks man.

Fallblau
Dec 09, 2005, 04:31 AM
Fallblau
Page file size doesn't show exact virtual memory usage. Virtual memory tab in task manager shows that per-process (this column must be explicitly added, by default it's not shown).

I think you should try following settings:
insane_mode = 0, vid_mem_usage = 80

Also note that game might swap for the first time you see some land or some country, but optimizations made by my fix allow more data to stay in memory than without my fix, so system swaps less.

For example, 1Gb systems should experience no swapping at all.

Also please read post #1 again (I made update about zlib1.dll there). You *MUST* download it not because I made some improvements to zlib1.dll (I didn't), but because it loads PatchByHarkonnen.dll into civilization4.exe process. Same stands for those who used python24.dll earlier.



Hi Harkonnen...

Yeah, I don't have the VM tab enabled, but with the same background processes running in the with/without scenarios, the general pagefile size is still relevant...

Will try insane_mode = 0 and vid_mem_usage = 80 and see how it does...

I was indeed using your zlib1 when your patch was installed... Verified by seeing the task button included the "Patched" text...

I'll give it another go and see how it does this morning...

Michelangelo
Dec 09, 2005, 04:42 AM
In your first post you mention that you'll need a TnL capable graphics card. I'm one of those the still have an intel card without it. Graphics increased dramatically for me with 1.09, but could use this patch.

Can I still use your patch with this card?

JorenCombs
Dec 09, 2005, 05:14 AM
First off, :eek:! I'm amazed at the whole idea and that the fan community can do this! I'm new to Civ4, but with a community like this I may be around a while :D. Good work!

Now onto the results...

I installed the patch and have had some mixed, but better :) results.

Here's my sys specs
Athlon 64 3000
MSI K8N Neo2 Platinum mobo
1024 MB memory
nVidia GF4 Ti4200 w/128 MB memory.
AGP Aperture is 128 MB.

Civ4 stuff
BlueMarble mod installed
High textures, no AA, 1024x768.
I didn't change the D3D9 and DynamicAnimPaging settings because it worked the first time, so no need to change those, if I understand your advice correctly.
EDIT - this is full-screen mode, BTW

Harkonnen.ini
vid_mem_usage = 136

I tried loading my crazy save game that always CTD'd. Memory usage prior to the patch was 1195172. With the patch on insane mode, 1047592 is used for a net gain of 147580. As expected, Alt-TAB does not work (you get no textures or city buildings, though you can see animations from tile improvements and units!). Not really much of a loss since Alt-TAB had a tendency to CTD under the old one anyway. Before switching out to test memory usage I zoomed all the way out and back in (I figured that'd be good since it swapped like crazy before). Zoom's faster now, less chunking.

But then I tried the patch with insane mode off and got a bit of a surprise. Memory usage is 1192804, for a net gain of...get ready...2368. I guess that's something, right? :). But there's more...Alt-TAB actually works now without any CTD. Without the patch it was unstable. Zooming out and in is about half as slow as without the patch. It doesn't really make sense, does it, given what I've been reading in this thread and how there's some problem with globe view you want to fix, but on my box it actually helped. The game still swaps like a poker cheat, but it's faster and more stable. Go figure.

Any suggestions for how I could improve swapping? Should I try uninstalling BlueMarble? (seems like those nice textures would have some kind of a price tag, right?)

Fallblau
Dec 09, 2005, 05:27 AM
And now for your local P.I.T.A report... :blush:

OK, this morning's results:

Set for insane_mode = 0, vid_mem_usage = 80, turned the VM column on in Task Manager as you suggested.

Fullscreen, 4xAA, All High

WITHOUT PATCH
534,984K Mem Usage
729,596K VM size
--------------
1,218,328 Total

WITH PATCH
645,804 Mem Usage
642,764 VM size
-------------
1,288,568 Total

An INCREASE of 70,240K

Windowed, 0xAA, All High

WITHOUT PATCH
345,376 Mem Usage
733,084 VM Size
------------
1,078,460 Total

WITH PATCH
628,776 Mem Usage
625,756 VM Size
-------------
1,254,532 Total

An INCREASE of 176,072K

So, on (and I'd like to stress this) my machine, it is actually detrimental, and visibly so (scroll is actually slower, etc...). But that's MY machine, and many others are seeing improvement, so don't think I'm trying to take anything away from your accomplishment.

Now my machine always ran the game "OK", if not really well, so I was not quite as in need as others... Consider this your "really odd testing case outside of the statistical norm"... :)

By the way, I'm running Blue Marble as well, so perhaps there's something with it's texture set (which definitely "runs" better than the standard, seeded textures) that is throwing your patch off...

Again, you've done some righteous work here, regardless of whether my box likes it or not, and you've made the game playable for many who could not play it before... So "hats off"! :goodjob:

Bast
Dec 09, 2005, 05:40 AM
I can run my game very well but once every 10 minutes or so I get a random slowdown on huge maps late into the game. It's a noticeable slowdown but it's not permanent and only lasts a few seconds.

Will this fix it?

JorenCombs
Dec 09, 2005, 05:45 AM
FallBlau, that's odd...

Your physical memory usage is increasing by leaps and bounds but your VM/swap file is decreasing. How does the game feel, speed-wise and disk-activity-wise? Seems like less VM should mean better performance.

I always wonder why, when I look at memory usage, Civ IV puts soo much into the swap file when there's plenty of physical available that it hasn't used...

Smidlee
Dec 09, 2005, 05:50 AM
I've also checked out the patch.

I have a Clevo laptop with 2Ghz Pentium-M, 1GB RAM, 256MB X800XT Mobility video

With the 'safe' setting of vid200 it spared me 126MB RAM and the insane mode 115MB more.

But both settings slowed my in-game scrolling speed down (i'm using 1680×1050 res, 2×AA, max detail)

The insane mode slowed the map scrolling very much but even with insane disabled it got slower.

So for now i've disabled your patch but i'm awaiting new developments to be able to play a huge/18civs game without crashing (i think it's able even now with the patch just i have a good large/9civs/epic game on the way with i'm on the lead :-)).

A lot of gratulations for your efforts and success at reducing memory needs for this game!!!
Checking further developments...
I have to agree your patch doesn't help me much either. I used your saved game to test my performance. I have AMD3800+,2gb of ram, 7800gt card. It seems if you have 2gb of ram then your patch doesn't help for the more memory the game uses the better it runs. The movies did run better with your patch though. My game still sometimes crashed when i try to reenter even with setting vid_mem_usage= 200 and insane mode=0

BUT..... then I tried to use atlas map generator to build a impossible size map ( this is superhuge 256 X 160) and notice a huge improvement. This is probably because these superhuge maps starts using over 2gb of ram from the very beginning. When maps are bigger than my ram I notice it take a lot longer to load the map and also can lock up for a few minutes if you scroll around the map (as if there are traffic jams in my pc). This time with your patch it started out only using 1.4 GB when I look around using worldbuilder with no traffic jams. that's over 600mb of ram difference. (Still I doubt this size is playable when it gets loaded toward late in the game)

So in my case your patch doesn't help much until the map need more ram than I have. Because of your patch I can now play even bigger maps than before. Still if Firaxis does included your fix in the next patch I hope we still have an option to turn it off since I won't be playing on these superhuge map often.

P.S. I believe you are right it's the cities that slows down the globel view. Even with a superhuge map with no cities I'm getting over 60fps in GV.

Harkonnen
Dec 09, 2005, 06:18 AM
HERE GO A LOT OF REPLIES. IF I FORGOT SOMEONES, PLEASE ASK AGAIN.

ALL
One general thing I forgot to mention. If you ever turned AGP off (smartgart for example with ATi), you should turn it on for this patch to bring most of its benefits.

kettyo
I don't understand what d3dquery and dynamicanimpaging is at all, sorry
Well, I don't have exact answer too... just these things might affect how my patch works,
so I tried to repeat my config in order to make fixes/suggestions easier when someone faces pr