Multi-core support?

I notice that Cataclysm only ever uses 25% of my 4-core CPU load. I’m guessing cataclysm doesn’t support multi-core then, like virtually everything else in the world.
Will Cata ever have multicore support though?

I imagine its going to eventually be needed when the game starts to get more complex in the near future in regards to processing objects, entities and properties

Short answer is no.
Long answer is:

  1. Multithreading doesn’t help on single-core systems, and we intend to continue supporting single-core systems.
  2. There are tons of things we can do to improve performance without multithreading.
  3. Multi-threading is a huge pain in the ass.

[quote=“Kevin Granade, post:2, topic:10064”]Short answer is no.
Long answer is:

  1. Multithreading doesn’t help on single-core systems, and we intend to continue supporting single-core systems.
  2. There are tons of things we can do to improve performance without multithreading.
  3. Multi-threading is a huge pain in the ass.[/quote]

Yeah, supporting only multi-core systems will break the compatibility with single-core systems and I don’t think cdda needs it.

Do we have anywhere that is a decent representation of “things we can do to improve performance” and other code-related issues that aren’t features?

Lights, fire, pathfinding; those are the real big three. There’s also a fairly large bunch of smaller features, like mapgen, item processing, and anything else that involves handling hundreds or thousands of things simultaneously.

Pathfinding isn’t actually that expensive, because it is only used by the NPCs.

What is probably the most expensive thing right now is monster sight checks, because each monster needs to check all monsters from all unaligned factions.

It partially depends on the scenario.
Lots of monsters cause load for various reasons that can probably be improved.
Fire is improved but it’s still a naive cellular automata simulation that checks its surroundings a LOT so it’s pretty expensive.
Scent diffusion is under control, but if it were improved by a lot it would enable some additional features (different monster groups having scents, which the player could detect).
FoV (Field of View) and lighting are still pretty expensive, and are going to get worse with 3D maps enabled.
Mapgen has several corner cases where it locks the system for up to a minute generating things, the most obvious of which is when it spawns a large number of vehicles on top of each other.
The bulk of game startup time is spent loading json files, which could be a lot faster.
There are some places where animation delays cause pauses, but that’s not a performance thing, it’s literally sleeping to make animations happen.
In tiles mode, tile lookup has grown a bunch of different fallbacks which is contributing to general slowness there.

A note on performance work though, if you don’t fire up a profiler or write a timing benchmark to verify your results, I don’t want you making performance-based pull requests. If it’s not verified it’s just guesswork.

Well, of course. Despite my appearance, manner, work ethic, grooming, hygiene, dress sense, grammar, punctuation, and capitalization habits, I’m not a complete amateur.

Sorry, that “you” wasn’t aimed at you, but rather some "you"s in the past that were real youhoos.

I’m not offended - just being cheeky.

Cheek-mate.

If we had more bug bounties I could justify spending $300 on a fire models book. :stuck_out_tongue:

I think npc pathfinding becomes a problem when sleeping in a difficulty to traverse area. I had some problems with lag while sleeping in a shelter with several vehicles parked outside next to the entrances. (and pits and traps placed around the shelter). It looked like the game hanged every time I went to sleep.

So, how come COMPILING.md has the line:

If you have a multi-core computer you’d probably want to add -jX to the options, where X should roughly be twice the number of cores you have available.

[quote=“Chezzo, post:14, topic:10064”]So, how come COMPILING.md has the line:

If you have a multi-core computer you’d probably want to add -jX to the options, where X should roughly be twice the number of cores you have available.[/quote]

That refers to how much commands will be run simultaneously after you’ve launched make. IOW, it only affects the building process.

[quote=“Soyweiser, post:13, topic:10064”]I think npc pathfinding becomes a problem when sleeping in a difficulty to traverse area. I had some problems with lag while sleeping in a shelter with several vehicles parked outside next to the entrances. (and pits and traps placed around the shelter). It looked like the game hanged every time I went to sleep.[/quote]This is next on my list to poke at.

[quote=“Chezzo, post:14, topic:10064”]So, how come COMPILING.md has the line:

If you have a multi-core computer you’d probably want to add -jX to the options, where X should roughly be twice the number of cores you have available.[/quote]
Because if you are compiling you can compile with multiple threads simultaneously, roughly reducing the time it takes to compile the game by about a factor of 4. It has literally no effect on the actual result created after you compile the game, just how quickly your computer can compile it (and is one of the basic arguments respected by pretty much any compiler anywhere).

Related: http://smf.cataclysmdda.com/index.php?topic=10801.0

Yeah, if you decided to make an overhaul MOD with Unity (or whatever) which would utilize 3D graphics, particles and smoke plus visual candy - you’d wish for more proc power. Essentially, assigning more resources to the engine itself AND using modern technology (hello 64-bit) would devour more RAM so multi-threading would come in really handy.

I’d like to see some tests with both OpenGL and DirectX before even attempting to employ secondary (tertiary, …) cores.

Here’s one curious thing I found: higher resolution leads to noticeably lower performance. How do you explain that?