We-the-People-civ4col-mod / Mod

This is the repository where the mod resides.
89 stars 37 forks source link

General AI issues (correctness, performance and improvements) #171

Open devolution79 opened 5 years ago

devolution79 commented 5 years ago

Note: This ticket is intended for small fixes that are too obvious and\or simple to warrant a separate ticket.

NoFreeUsernameDammit commented 5 years ago

I'm not sure if it belongs here, but I noticed in my last game that AI does not produce religion FFs at all, meaning it does not do anything religion related. It's 1614 AD in my game (marathon, no idea how many turns passed), all european nations in game, and no AI picked up even first religion FF I rejected.

devolution79 commented 5 years ago

I suppose we need a separate ticket for that discussion. The AI is quite weak when it comes to the crucial early game and one of the many problem are the lack of focus on cross production (which would translate into increased immigration and potentially religious FFs). I've also observed (during autoplays) that the AI may hardly produce any crosses well into the mid-game.

devolution79 commented 5 years ago

76842e0199306ea83256c4b7c216f91901bc2930 was adapted from the following K-Mod commits: https://github.com/karadoc/Civ4-K-Mod/commit/103ef3477753a12f9364cb6a091e30d81e6e17a3 https://github.com/karadoc/Civ4-K-Mod/commit/6047432cf43a3f94b7ae5a235f137a8ad475cdf6

baseMoves() is the actual number of movement points of a unit and it is what the AI should consider when determining search ranges, promotions etc. getMoves() and maxMoves() are only useful for (internal) pathing calculations

Original commit comments from Karadoc: "The main side effect of this was that many searches too longer than they should; but it also resulted faulty reasoning for some decisions (eg. thinking the enemy was in range when it wasn't). This was mostly in old naval AI code. The main effect of this was to increase the search time for the AI by searching around 400 times more plots than intended."

devolution79 commented 5 years ago

Note that during testing I observed that the cached max visibility range was 10! This may be one of the reasons why the plot processing is rather slow. We should consider a more clever way of doing this since rarely will a unit acquire all the promotions to make this search range necessary. I also probably misused this ticket since this change wasn't really about the AI, oh well...