5

When running CiV on a newer high-end computer, it will sometimes crash. The usual message is a segmentation fault or similar problem.

Crashes happen seemingly randomly, though usually between pressing end turn and being given control again. That may be random though, as the game does most of its processing at that point.

Downgrading the processor seems to resolve issues (via the bios, or by doing some computer building), which seems very strange?

2 Answers 2

5

Possible cause: >8-core bug

Civilization V has a known issue where it assumes that a computer can't have more than 8 CPU cores. This assumption was (mostly) true at the time of its release: only some very expensive server CPUs and dual-socket systems had that many cores1. SMT virtual 'cores' also counts toward this maximum.

If you have a modern, high end processor, these nowadays come with 12, 16, or even more virtual cores, and whenever civilization happens to run on more than 8 of them, it may crash occasionally.

You can fix this by setting the process affinity mask such that Civilization will run only on the first 8 cores. Scroll down to your specific operating system and follow the instructions for it.

Windows

Open the task-manager using Ctrl-alt-del. Right click the Civilization process, and select configure affinity.... Configure the Civilization process to only run on at most 8 cores, and only on the first eight cores in that list.

You can also create a .bat script to do this for you every time the game starts up. Use the command

start /AFFINITY FF CiV.exe

to start the game with the affinity mask on the first 8 CPUs. For more information on how masks work, see this question over at SO. Here the values 1, 2, 4, 8, 16, (...) are your CPU cores.

Crazy computers

If for some reason you want to run this game on a crazy powerful computer with say two AMD EPYC 7601s (64C/128T) then you'll have to read up on Processor Groups as well.

Linux

For Linux; run the following command after starting the game, where PID is the process ID it happens to be running at (you can find this out by using top or a similar command):

taskset -p 0x000000ff <PID>

You can also use your desktop environment's process manager, e.g. KSysGuard or gnome-system-monitor. It's also possible to script this. Replace the startup command for Civilization 5 in its startup .sh script from CiV (where this is whatever command runs the game) to taskset 0x000000ff CiV

Or, when running from Steam, change the command line parameters, which can be found under: Right-click the game title > Properties > General > Launch Options to:

taskset 0x000000ff %COMMAND%

Also see the help page.

If your system is NUMA (like AMD Threadripper or a Workstation using 2 server-grade CPUs), or has a very large amount of cores (>32), you'll have to use numactl instead.

numactl --physcpubind=+0-7 CiV

1: There was one exception: The only consumer CPU that did at the time of its release was the Core i7-980X, a $1000 part.

4

For me, on linux, a simpler solution from this reddit worked like a charm:

I changed "MaxSimultaneousThreads" in the file

.local/share/Aspyr/Sid Meier's Civilization 5/config.ini

from 8 to 16. In my case it fixed the problem


This setting can also be changed on Windows:

\Documents\My Games\Sid Meier's Civilization 5\config.ini

However, any value greater than 16 is not supported according to this website. Quote:

Values for MaxSimultaneousThreads greater than 16 are unsupported and clamped.

So, it could possibly still crash on much newer system that has more than 16 threads. In that case, accepted answer's trick should work.


Here is a screenshot of this config file and the working game:

enter image description here

2
  • Btw, I ended this particular game, which took around 5 hours, without any crashes ^_^, before it crashed in like 5 seconds after starting
    – Klesun
    Apr 19, 2022 at 19:23
  • Nice find! I've suggested an edit to include the location of config.ini on Windows(I'm not sure if Mac version of Civ 5 has one though, but it should be somewhere...) and limitation of MaxSimultaneousThreads. Hope this helps future readers.
    – Skye-AT
    Apr 21, 2022 at 2:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .