HUGE AI improvement

Published on Tuesday, March 25, 2008 By Brad Wardell In GalCiv Journals

One of the most frustrating parts of the GalCiv AI for me has been the planetary improvements.  It is the single biggest piece of the code I didn't write and to be honest, my C++ skills are relatively basic. I'm an algorithm guy, not a particularly good coder. The result is, I've always had a hard time working on the improvement code because it's hard for me to understand (it was implemented as a quasi-SQL database as opposed to say a linked list or an array).

So anyway, while playing this weekend, I finally came to understand the single biggest problem with the computer AI with planetary improvements: It doesn't check to see if it is already building a super project or achievement on one of its other planets.

This is a pretty big deal because what will happen is that if it wants to build an economic capital, odds are, quite a few planets may have the same idea. But when the other planets try to put that into the queue, it gets rejected (without the AI knowing it).  As a result, during that entire time, the AI is building nothing.  So players would come across AI planets with hardly anything built.

Now, this doesn't stop the other pet peeve - the AI building stupid things on a planet (like 10 morale buildings or something).That, I still haven't figured out but I'm working on it.