Multithreading and other performance improvements in CiV

3335d

CCtP Player
Joined
Jun 15, 2012
Messages
642
Does have any ideas of where this may be possible? It is a necessity to implement this so that people with fewer than 6 cores in their computer's central processing unit are able to play heavy CiV mods.

I was thinking that in the space of unit movement there is a lot of space for improvement. All units able to attack x target within y turns had they been enemies, whether or not they are actually enemies, could be assigned a "general." These generals would be fed with information not only about their local circumstances but about the grand view of the AI as well, and upon the giving of all necessary information the different "generals" could be assigned to different threads running on different cores.

This would *not* change any game rules or take away the sequentiality of turns between different AIs. Rather, it would make each individual AI move all "armies" controlled by all "generals" simultaneously. If this solution is possible, I think that it will drastically cut down on turn time. There's no need for each unit to consider all possible tiles on the board.

Another solution to allow for improved performance both in terms of multithreadability and reduced number of instructions would be to separate the tactical AI into two separate parts - the transport AI and the battlefront AI. The transport AI would actually not be much at all, just deciding if and when to load units onto larger transport vehicles (which should be added) or which paths to take to the battlefield individually, while the battlefront AI should be specifically focused on the movement required in order to defeat an opponent in battle. Upon reaching the destination of the transport AI, control of the unit would be handed over to the battlefront AI. All of this would happen within the context of the "general" discussed earlier.

Building completions, specialist assignments, and great-person bulbs/settling could all take place simultaneously, as could the completion of improvements (but not the founding of cities).

I don't know C++, so could anyone tell me if this is feasible, or if it would result in substantial performance improvement in CiV if it could be implemented?
 
Top Bottom