Figured I might as well start a new thread for this topic since it comes up a lot.
As you may know, I'm on an ongoing crusade to improve turn times, and most weeks I spend at least one day profiling and trying to improve matters. As I mentioned a few days ago, a save game I had to fix a WFoC issue also struck me as displaying nasty performance issues, so I spent a while looking into that save game a bit more deeply. That quickly identified the problems with the great commander game option, which I've posted about elsewhere.
Anyway, I got back to the same save game again today, and delved a bit deeper. What I found was quite interesting. I already knew that a lot of the time spent on AI turn processing was in unit path evaluation, as it decides between different options (in that save game, which is pretty typical for a mature game on a large map, it was evaluating about 40,000 paths per turn). The thing I hadn't realized, until I analyzed it more carefully, was that only a few hundred of these path evaluations were dominating the total. A major cause is units deciding on a target city for a potential attack, where they check out every potential enemy city on the same landmass. On large maps that are highly connected this can amount to practically every city in the game, and, more importantly, VERY distant cities. The cost of evaluating the optimal path to a plot rises roughly with the square of the distance, so these tests of distant cities wind up contributing highly disproportionately to the total time spent.
I'm working on changes to alleviate these costs, but the interesting take out for now is that very large land masses will seriously impact the game performance. The test game in question was a giant map of earth, with the north pole providing an ice bridge, which essentially means the entire world is one land mass apart from a few 'islands' (Australia primarily). Until I manage to address this (and even then to some extent, since although I expect to be able to reduce the issue, it won't entirely go away) I recommend archipelago, or island maps, or at least those that tend to have multiple continents.
As you may know, I'm on an ongoing crusade to improve turn times, and most weeks I spend at least one day profiling and trying to improve matters. As I mentioned a few days ago, a save game I had to fix a WFoC issue also struck me as displaying nasty performance issues, so I spent a while looking into that save game a bit more deeply. That quickly identified the problems with the great commander game option, which I've posted about elsewhere.
Anyway, I got back to the same save game again today, and delved a bit deeper. What I found was quite interesting. I already knew that a lot of the time spent on AI turn processing was in unit path evaluation, as it decides between different options (in that save game, which is pretty typical for a mature game on a large map, it was evaluating about 40,000 paths per turn). The thing I hadn't realized, until I analyzed it more carefully, was that only a few hundred of these path evaluations were dominating the total. A major cause is units deciding on a target city for a potential attack, where they check out every potential enemy city on the same landmass. On large maps that are highly connected this can amount to practically every city in the game, and, more importantly, VERY distant cities. The cost of evaluating the optimal path to a plot rises roughly with the square of the distance, so these tests of distant cities wind up contributing highly disproportionately to the total time spent.
I'm working on changes to alleviate these costs, but the interesting take out for now is that very large land masses will seriously impact the game performance. The test game in question was a giant map of earth, with the north pole providing an ice bridge, which essentially means the entire world is one land mass apart from a few 'islands' (Australia primarily). Until I manage to address this (and even then to some extent, since although I expect to be able to reduce the issue, it won't entirely go away) I recommend archipelago, or island maps, or at least those that tend to have multiple continents.