1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Increase Memory on 64bit Machines

Discussion in 'Rhye's and Fall - Dawn of Civilization' started by Leoreth, Feb 24, 2015.

  1. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    34,410
    Gender:
    Male
    Location:
    Leblanc
    While discussing the implementation of the graphical paging feature with some people over at the C2C forum they made me aware of a tool that can increase the amount of available memory for 32bit executables on 64bit machines from 2 GB to (almost) 4 GB.

    Some background: Civ4 is implemented as a 32 bit application which limits the amount of available RAM to 2 GB, even though 64 bit machines can provide much more than that (which your computer is likely to have).

    So if you have a 64bit operating system, you can download this tool and execute it on the Civ4BeyondSword.exe file in your BeyondTheSword folder to increase the available memory to 4 GB (this applies to all BtS games and mods).

    If you are running a 32bit OS, this tool unfortunately cannot help you.

    I really recommend doing this if you have problems with performance.
     
    pbl987, Nightinggale and ales_ like this.
  2. need my speed

    need my speed Rex Omnium Imperarium

    Joined:
    Oct 3, 2009
    Messages:
    2,125
    Gender:
    Male
    Location:
    European Union (Magna Batavia)
    And while reading through a random thread a few days ago, I stumbled upon this, which is said to vastly increase the inbetween turn time speed (among other things, I guess?). I haven't tried it yet, but it sounds interesting.
     
    Nightinggale likes this.
  3. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    34,410
    Gender:
    Male
    Location:
    Leblanc
    Looks interesting, I will give it a try.
     
  4. Tomorrow's Dawn

    Tomorrow's Dawn Heroes Never Die

    Joined:
    Dec 27, 2009
    Messages:
    3,618
    Location:
    SF Bay Area
    Wow, just tried it for myself and the difference between the old load times and the new are staggering.
    I can't give an accurate estimate by how much faster it feels, but it's like somewhere between 20-35% faster on everything, turn times, load turns, loading saves, etc.
     
  5. ezzlar

    ezzlar Emperor

    Joined:
    Dec 21, 2001
    Messages:
    1,698
    Ramdisk or the memory usage change? Anyway, it sounds great. I will test it.

    Leoreth, if it works, why not put it in the download thread?
     
  6. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    34,410
    Gender:
    Male
    Location:
    Leblanc
    Because it's an exe. I know you probably trust me, but some additional legitimacy from the actual source doesn't hurt.
     
  7. Tomorrow's Dawn

    Tomorrow's Dawn Heroes Never Die

    Joined:
    Dec 27, 2009
    Messages:
    3,618
    Location:
    SF Bay Area
    I'm not sure, I'll have to keep my Task Manager open but my turn times seem to be significantly faster, as well as loading saves in general.
     
  8. Theodorick

    Theodorick King

    Joined:
    Jan 1, 2006
    Messages:
    624
    I'll have to try this out soon. I keep getting bummed out playing the Canadians, because the turns are ridiculously long, and sometimes it even freezes somewhere in the 19th century before I can even play. I'm 64bit and have an excellent computer.
     
  9. borhap88

    borhap88 Prince

    Joined:
    Feb 11, 2012
    Messages:
    539
    Location:
    Italy
    It works, thank you!
     
  10. Theodorick

    Theodorick King

    Joined:
    Jan 1, 2006
    Messages:
    624
    Why would you want to increase the turn time?
     
    ales_ likes this.
  11. need my speed

    need my speed Rex Omnium Imperarium

    Joined:
    Oct 3, 2009
    Messages:
    2,125
    Gender:
    Male
    Location:
    European Union (Magna Batavia)
    I like you. :p
     
    ales_ likes this.
  12. rigo92

    rigo92 Chieftain

    Joined:
    Nov 7, 2009
    Messages:
    61
    Location:
    San Salvador, El Salvador
    I did a quick speed test with the exe. A 600 AD French game took 55 seconds to load normally, and 50.5 with the exe. That is an improvement of about 8% less load time, although I imagine it would have been more significant in the late game (as the late game has more civs and stuff and should require way more memory). I couldn't test it with the 1700 AD scenario because now that the bts exe is patched I have no idea how to un-patch it to make a comparison.

    On the other hand, RAMDISK seems to have a lot of potential. I installed it and created a 4 GB RAMDISK (the largest possible in the freeware version), however after copying vanilla Civ 4 and BTS I am unable to start BTS as it always gives an error along the lines of "failed to initialize python". Anyone managed to get it working? If somebody helps me out I will post a speed comparison pre and post RAMDISK.
     
  13. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    34,410
    Gender:
    Male
    Location:
    Leblanc
    Haven't tested Ramdisk yet, I'll try to write up a guide for setting it up for BtS in case I manage to figure it out at some point.
     
  14. Shadow Warlord

    Shadow Warlord Warlord

    Joined:
    Oct 24, 2014
    Messages:
    272
    From what i've read online it sounds like 4 GB alone may not be enough to load a game onto it and function.
     
  15. CaterpillarKing

    CaterpillarKing Conqueror of Cacoons

    Joined:
    Feb 11, 2014
    Messages:
    6,312
    Location:
    On a leaf
    I used this and it doesn't seem to work. Do I have to do it on each seperate mod? I do run a 64 bit OS and I have 4gb so that isn't the issue. Thoughts?
     
  16. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    34,410
    Gender:
    Male
    Location:
    Leblanc
    You have to do it on the BtS EXE.
     
  17. Pavel Chichikov

    Pavel Chichikov King

    Joined:
    May 26, 2012
    Messages:
    668
    Can I apply this safely to other games, say Half-Life 2, GTA or Alpha Centauri?
     
  18. CaterpillarKing

    CaterpillarKing Conqueror of Cacoons

    Joined:
    Feb 11, 2014
    Messages:
    6,312
    Location:
    On a leaf
    I did. Did nothing.
     
  19. Nightinggale

    Nightinggale Deity

    Joined:
    Feb 2, 2009
    Messages:
    4,420
    I just came across this thread and I have to say you shouldn't hide it that well. It really should be in some sort of "public library" with useful information, which applies to all mods.

    I haven't tested it yet, but theoretical knowledge tells me this:

    Expanding RAM address space:
    I have known for ages that 32 bit can't access more than 4 GB RAM, which supposedly should be a prime motivator for moving to 64 bit systems. Don't listen to the talk about performance because some early 64 bit CPUs ran faster in 32 bit mode.

    However I have always believed that 32 bit applications can use 4 GB when used on a 64 bit system. I have never heard of a 2 GB cap, though based on the description, it seems like a fair decision to add on 32 bit systems, meaning it's a relic, which we no longer need. I kind of suspect this to be a windows issue and that using 32 bit applications on mac or linux will not have this problem.

    From a first glance, the only effect would be to avoid a crash when reaching 2 GB usage, which I guess is still the primary goal. However I find it plausible that it might improve performance in some cases. This would be due to memory fragmentation. If the game has twice the memory, it can spread out and can allocate twice as much memory before congestion issues appears. This is kind of like HD fragmentation. If you use 80% of a HD, it will be fragmented and slow down while using just 30% will counter most of this problem, even if you have the same amount of data on equally fast HDs.

    RAM disk:
    I have been using these on and off since the late 90s. They are great when used right, but used incorrectly you will not really gain anything.

    Using memory has both higher bandwidth and lower latency. This means it will be insanely fast, but only if the disk access is the bottleneck. I once placed Neverwinter Nights 2: Storm of Zehir expansion in a RAM disk due to game breaking loading times. Turned out that disk access wasn't the issue, but rather what the CPU did to the loaded data, meaning the loading time depends on CPU speed rather than disk speed. NW2:SoZ was slammed in reviews for way to long loading screens, which often interrupts the gameplay, but it's actually pretty decent on modern hardware.

    The improvement of using RAM disk increases the slower the HD is. SSD owners will see less of an effect and copying from a DVD to RAM disk will make a world of difference, mainly due to seek speed improvements.

    Expected effects on Civ4: (any version)
    Clearly expanding RAM allows bigger mods. It may increase performance in big games as well. RAM disk on the other hand will likely have less of an effect. Starting the game will likely improve, but the important part about performance is how long you have to wait for the AI. The AI doesn't use the disk at all, meaning I wouldn't expect any difference here whatsoever. It's also important to note that a not insignificant part of the loading time is the windows overhead from opening and closing a file, which will not be improved.

    Autosaves have been mentioned as being faster and while it's most likely true, do you really want to save to a location, which is gone if your computer crashes? Savegames is likely the most important thing to store on a permanent disk. RAM disks should be for temporal files only.
     
    TJDowling likes this.
  20. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    34,410
    Gender:
    Male
    Location:
    Leblanc
    You're completely right, this should probably go into the tutorials section at least (I'd prefer the wiki but afaik it's still write locked for some reason). I also only learned about it through word of mouth and basically rushed to share it with my players because I had acute issues with memory related crashes around that time (ultimate cause was the overreliance on FPKs like you described in the thread that likely led you here) so I unfortunately never considered how useful this information is for everyone.
     

Share This Page