Making the Forts AI Whole

Work continues apace. Nick has been developing the single player campaign and touching up a few of the graphics. Jeff has started on the music but we’ve yet to hear it. We know it will be great!

I’ve had my head buried in optimisation, bug fixing and filling holes in the AI. In Forts you can connect to ‘neutral’ structures and instantly gain control of them. The AI was able to do this, but if the neutral part of the structure was destroyed it couldn’t replace it.

Now it can rebuild even if the whole structure is gone. At the beginning of the match it scans the world for structures it owns as well as neutral ones and builds actions from them for reconstruction. It ignores structures it never intends to connect to. Additional joint creation actions need to be added where the human recorded AI fort pattern connects with the neutral structures in case the destination node is gone.

Sometimes the AI gets stuck on a particular action, unable to execute it. I’ve introduced a frustration system so after several attempts it gives up. Frustration levels of all actions are decayed periodically, so any frustrated actions will be attempted again. Some actions can execute but form unstable structures that soon collapse. I’ve got to detect when this happens and add frustration so the AI tries something else.

Another thing the AI had trouble with was the ropes. They are treated differently to other materials in that when the player (or the AI) creates a rope the game creates a series of linked invisible and unselectable joints along the length of it. Any of these links can break, but the AI had no knowledge of them and so could not replace them. Now the game follows the rope back to the end joints and reports these to the AI script. It is also told about which link actually broke, which allows it to attempt reclaim of the dangling bits of rope.

To help me quickly test this functionality I’ve build specialised maps. The image below shows the AI rope test map. You can see a (dark) neutral structure in the bottom right; ropes don’t claim them. When you attach bracing, armour, etc. to the structure it lights up and you can manipulate it and any weapons on it.

Testing the AI reconstruction of ropes