You read right, earlier than I expected I started to implement computer controlled enemies (aka “AI”) that’ll control all non-player regions.
But before doing that step I did a lot on the code and made sure all features worked as expected and that there were no bugs left, so I can fully concentrate on the AI without having to fix problems or bugs at the same time. Luckily there wasn’t much to be done on that part, and except for one or two annoyances (e.g. one where you would always move the first created division, even if another one was selected) I didn’t encounter any problems or bugs. So I also used that time to create some icons for different buttons in the espionage window (buttons without icons are actually harder to recognize, so the final game will have icons for all buttons) and to make some minor adjustments to the GUI in terms of usability.
And then yesterday I finally started to get my hands dirty on code for the AI. At first (as mentioned in a comment for my last posting) I wanted to “implement” different behaviour via lists (for e.g. buildings and research) that would have been premade in the Editor and would include a certain building order for different personalities. But I dropped that idea very soon after I wrote a first implementation of the constructing part of the AI and found out that this actually works equally good (or mostly better) and is better to tweak (no more lists, just some parameter adjustemts). That new approach to the construction AI selects the type of building by checking the demand for a certain value of the region, and it has a special “path” for creating military buildings if the region has a high risk factor (sourrounded by a lot of enemy regions). So basically it has a priority list that changes with it’s personalities and goes like this : “energy is the most important, max. population comes next, ressources production at third, and so on…”. Round after round it then goes through that lists and checks if that value is below a certain configurable threshold (e.g. current energy is below 0.2) and then constructs a building that produces energy. If that value is above the threshold it’ll check the next demand value in it’s list and so on. So for different personalities I’ll now won’t have to create different building-order-lists in the editor, but just create a list of the order in which it’ll check values with their thresholds. And though this isn’t the most interesting and/or advanced type of constructing AI I think it’ll get it’s job done and for the first release of the demo it should be more than enough.
And to help me seeing what that AI actually does, and mostly if it does what I want it to do, I added a new debug window for the AI controllers (one for each nation, the personality of each AI controller can be changed on the fly) which includes some debug options (like advancing a certain number of rounds) and mostly the debug log, where the AI writes down what it’s doing. This way I can always see where problems arise and so on.
So much for now, sorry for no new screenshots but AI is mostly code and nothing visual. Next step now is to tell the AI which armie units to build, how to manage them and where to move the divisions for defending it’s endangered regions.