Draconus – the fourth version of the AI

The fourth version of the AI, Draconus, has now been completed:

Draconus is an extremely powerful Azathanai, also titled the “Suzerain of Night”. His aspect is darkness. He was the consort of Mother Dark, and brother of both K’rul and the Sister of Cold Nights. When Mother Dark was just a Tiste Andii noblewoman, Draconus gifted her with his aspect, leading to her ascension. He and his siblings cursed Kallor to live forever and never ascend, and yet still suffer the ravages of time. At the same time, Kallor used the power of hundreds of thousands of deaths caused by the collapse of his empire to curse Draconus. The curse was that Draconus would be “[imprisoned] in a creation of his own making”. He and Sheltatha Lore had three daughters, Envy, Spite and Malice. He was also a blacksmith and the one who forged the sword Dragnipur.

Source: http://malazan.wikia.com/wiki/Draconus

The aim with Draconus was to make the AI able to perform two more objectives; guard cave openings as these are important strategically and to raid/pillage enemy terrain improvements. Both of these new objectives were already implemented in the first beta build that we uploaded to Google Play March 28th. But I also wanted to improve how the AI handles armies and troops when they weren’t needed, what I call the army reserve. Previously un-needed armies were just disbanded but this is very inefficient because each time the AI need an army a new one must be constructed. How to make the AI re-use old armies?

One more objective, of course… When an objective has been completed and its armies isn’t needed anymore they are now transferred to the closest army reserve objective. The AI will also build up the reserve even if there is no enemy in order to respond to military requests quickly. This forced me to make changes in several of the older objectives, but what really took a lot of effort was to make the planner (strategical ai) able to pull troops from the army reserves when it created objectives. The code for creating each objective needed to be modified to include the army reserves. Before a request for an objective could be ignored if there were no suitable settlements to build the correct troops. Now the planner first check if there are resources in the army reserves and perhaps the objectives need can be met even if there are no settlements that can build new armies.

I’m very satisfied with Draconus and the improvements it made to the AI. It’s still dumb and can’t value all requests correctly, but it’s better at handling its armies and taking care of its resources. I also took the opportunity to improve the rest of the code for several of the objectives hoping that the AI will perform a little better. ;)

As usual I’ve run a series of simulations to debug the code and see how the AI perform. It seems, when I study the scores of all empires, that they play ‘safer’. The difference between the top empire and the bottom empire is less pronounced. Before an empire could rush away in points just beacuse it did some lucky manouvre. It still happens from time to time, but not as often… In several scenarios all empires have been able to defend their capitals throughout the 150 turns played. That haven’t happened since I decreased the space between starting positions. It will be interesting to see if our beta players notice the difference… :)

Here is a summary of the abilities and features of the fourth version of the AI, Draconus:

Scout AI

    Is able to explore new territory, incl. unexplored cave openings, and to regularly re-scout already explored territory.
    Construct watchtowers to increase the territory that is automatically seen each turn.
    Keeps track of how many scouts there is on each land mass and requests more scouts when needed. It can also build and send scouts through cave openings in order to hurry up the exploration of that region.
    Is able to use un-claimed military armies to patrol the territory around its settlements. When no threat is nearby the army it will help with scouting and re-scouting if needed.

Settlement AI

    Is able to improve the infra-structure of the terrain in order to improve the food output.
    Can construct new buildings by following the directives from the Governor. Production of companies/squadrons is ordered by the objectives (see below).
    Can investigate its garrison troops and request better troops if available.

Objectives

    Garrison armies in a settlement that requests a new or improved garrison. If needed a new army will be constructed and sent to the settlement.
    Construct a standing army that can be used to patrol and hunt after enemy scouts that comes to close its own borders.
    Build up the army reserves even if there are no enemies in order to react quickly if attacked or if it needs to attack an enemy. Other objectives can pull armies from the army reserves and use them.
    Construct a conquest army and send it to an enemy settlement in order to conquer it. When the settlement has been conquered it will stay and defend the settlement if needed, otherwise it will leave a garrison and move to attack another settlement.
    Send a small raiding army to sack and pillage terrain improvements outside an enemy settlement.
    When the military advisor spot an enemy threat coming nearby a settlement it can claim nearby patrol armies as well build new defensive armies in order to protect the settlement that it believe will be targeted by the enemy threat.
    Send a defensive army to guard a cave opening from enemy intrusions.
    Construct a settler army and use it to create a new settlement or use it to increase the population in settlements that has requested more population.

Strategic AI

    Develop new technologies by setting both primary and secondary research objectives.
    When the right ‘technologies’ has been completed it can design improved troop types.
    Updating the influence map with allied and enemy strengths.

Draconus has, I hope, improved the AI quite a lot and made it more efficient in using its resources. For the fifth version, Empress Laseen, my intention is to improve how some of the objectives interact with each other and try to make the AI better at defending itself. When you start to play against your own AI you are bound to notice some oddities. My empire had put together a massive invasion army and had marched all the way to the enemy capital. When I looked inside the capital I saw that he was assambling a conquest army. I sent my own army a sector away from his capital and waited until he had sent away his conquest army before I attacked and took his capital. It’s stuff like this I’m going to look at for the next version, Empress Laseen. I’ve also noticed that the AI seem to have problems with its loyalty and its time to make the settlement AI able to deal with this.

Please let me know if you notice any improvements with Draconus! All input on its behaviour is appreciated as it helps me find oddities that needs to be fixed. ;)